首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏Reck Zhang

    ACMSGURU 134 - Centroid

    You must find the centroid(s) of the tree. (n + 1, 1); int centroid_value = INT_MAX; auto dfs_get_centroid = std::function<void(int, int )>{}; dfs_get_centroid = [&dfs_get_centroid, &node_count, &node_centroid, &centroid_value, &tree, std::max(node_centroid[index], node_count[child_index]); dfs_get_centroid(child_index, index ); } centroid_value = std::min(centroid_value, node_centroid[index]); }; dfs_get_centroid

    39420发布于 2021-08-11
  • 来自专栏DrugOne

    生物医学组学数据分类Deep Centroid

    Deep Centroid是种集成学习方法,具有多层级联结构,包含特征扫描和级联学习阶段,可以动态调整训练规模。 强调了Deep Centroid在生物医学组学数据分类中的应用前景,特别是在精准医学领域。 图1 Deep Centroid模型结构的示意图。 图2 Deep Centroid在癌症早期检测中的性能。(a) Deep Centroid在交叉验证中的分类性能。(b) Deep Centroid在独立验证中的分类性能。 图3 Deep Centroid在癌症预后中的性能。(a) Deep Centroid在交叉验证中的分类性能。(b) Deep Centroid在独立验证中的分类性能。 图4 Deep Centroid在药物敏感性预测中的性能。(a) Deep Centroid在所有药物中的分类性能。(b) Deep Centroid在他莫昔芬中的分类性能。

    16200编辑于 2025-02-18
  • 来自专栏凹凸玩数据

    R可视化 | 地理信息空间(下)

    ,y=centroid2,label=name))+ #加上业务信息(中心点经纬度信息) geom_text_repel(data=frame_data,aes(x=centroid1-0.25 ,y=centroid2+0.25,label=paste0(round(centroid1,0),",",round(centroid2,0))))+ coord_map("polyconic") ,y=centroid2+0.25,label=paste0(round(centroid1,0),",",round(centroid2,0))))+ coord_map("polyconic") ,y=centroid2+0.25,label=paste0(round(centroid1,0),",",round(centroid2,0))))+ coord_map("gilbert") ,y=centroid2+0.25,label=paste0(round(centroid1,0),",",round(centroid2,0))))+ coord_map("azequalarea

    91610发布于 2020-10-27
  • 来自专栏Frank909

    【机器学习】快速有效理解 K-Means 算法

    我们可以让它在数据值中最小值和最大值中生成随机数. def rand_centroid(dataset,k): n = dataset.shape[1] centroid = np.zeros = rand_centroid(dataset,k) print("centroid ",centroid) need_update = True while need_update 一定要搞懂 cluster_table 和 centroid 这两张表的意义。 cluster 每一行与 dataset 每一行对应 centroid 存放了 k 个质心的特征。 = rand_centroid(dataset,k) print("centroid ",centroid) need_update = True while need_update = rand_centroid(dataset,k) print("centroid ",centroid) need_update = True duration =

    1K20发布于 2019-01-14
  • 来自专栏生信菜鸟团

    R tips:使用最近邻算法进行空间浸润带的计算

    , # point cells_position$y_centroid, # point tumor_boundary$X, # polygon tumor_boundary , y = y_centroid ) tumor_area_2 <- cells_position[! cell_idx, ] %>% mutate(x = x_centroid, y = y_centroid ) 获得了浸润边界的两组细胞之后,就可以进行浸润边界的计算: # 根据tumor_area + boundary_2x_centroid) / 2, y = (boundary_1y_centroid + boundary_2y_centroid) / 2 ) 绘图展示,计算的圈画的浸润边界位置 , y = -y_centroid), color = "gray50" ) + geom_point( # comute left_boundary data

    43600编辑于 2025-02-18
  • 来自专栏生信菜鸟团

    R tips:使用ggplot2绘制空间坐标图

    ) range(coords_xenium2$y_centroid) coords_xenium_sub2 <- coords_xenium2 %>% dplyr: :filter( x_centroid > 3000, x_centroid < 4000, y_centroid > 2000, y_centroid %>% ggplot(aes(x = x_centroid, y = y_centroid)) + geom_point(aes(color = cell_id), show.legend <- coords_xenium_sub2 %>% ggplot(aes(x = x_centroid, y = y_centroid)) + geom_tile(aes(fill | p_xenium_centroid2 geom_point用于绘制空间原位图有一个缺陷,点的大小会随着导出图片的大小而改变,导致出现点太小或者点太大的现象。

    54410编辑于 2024-12-09
  • 来自专栏点云PCL

    PCL的PNG文件和计算点云重心

    #include <pcl/io/pcd_io.h> #include <pcl/common/centroid.h> #include <iostream> int main(int argc, char = 0) { return -1; } // 创建存储点云重心的对象 Eigen::Vector4f centroid; pcl::compute3DCentroid (*cloud, centroid); std::cout << "The XYZ coordinates of the centroid are: (" << centroid [0] << ", " << centroid[1] << ", " << centroid[2] << ")." << std::endl; } 这样就可以计算出点云的

    1.5K30发布于 2019-07-31
  • 空间转录组cell niche(流程试用版)

    <- xenium$adj_y_centroidxenium$super_adj_y_centroid[xenium$spatial_row == "R1"] <- xenium$adj_y_centroid adj_y_centroid[xenium$spatial_row == "R2"] + 2200xenium$super_adj_y_centroid[xenium$spatial_row == "R4 == "R5"] <- xenium$adj_y_centroid[xenium$spatial_row == "R5"] - 2200xenium$super_adj_y_centroid[xenium $adj_x_centroid[xenium$spatial_column == "C2"] - 2000xenium$super_adj_x_centroid[xenium$spatial_column == "C3"] <- xenium$adj_x_centroid[xenium$spatial_column == "C3"] - 1000xenium$super_adj_x_centroid[xenium

    70000编辑于 2024-06-08
  • 来自专栏TechFlow

    日拱一卒,伯克利牛叉,这是我见过最酷炫的Python作业

    最近的centroid。 每一个cluster是一个restaurant的list,这些restaurant有一个共同点,它们距离某一个特定的centroid比其他的centroid更近。 我们的目的是将restaurant根据距离最近的centroid进行分类,有了group_by_first函数之后,我们可以生成[[restaurant, centroid]]形式的数据,调用group_by_first 提示:使用utils中的mean函数实现逻辑 def find_centroid(cluster): """Return the centroid of the locations of the 和find_centroid函数 其实只要理解了group_by_centroid和find_centroid函数的逻辑,以及kmeans的算法原理之后,不难实现。

    90540编辑于 2022-09-21
  • 来自专栏人生代码

    数据挖掘实践指南读书笔记7

    for centroid in range(len(self.centroids))] def assignPointToCluster( in range(self.k): dist = self.euclideanDistance(i, centroid) if dist < min: min = dist clusterNum = centroid # here is where I will keep in range(len(self.centroids)): print ("\n\nClass %i\n========" % centroid) in centroidList[1:]: distance = self.eDistance(point, centroid) if distance

    58110发布于 2019-11-05
  • 来自专栏数据处理与分析

    生成面要素的中心点-GDAL

    OGR 1.10 Centroid(Geometry self) -> Geometry int OGR_G_Centroid(OGRGeometryH hGeom, OGRGeometryH hCentroidPoint ) Compute the geometry centroid. The centroid location is applied to the passed in OGRPoint object. The centroid is not necessarily within the geometry. This function is the same as the C++ method OGRGeometry::Centroid().

    2.7K20发布于 2019-07-31
  • 来自专栏GEE数据专栏,GEE学习专栏,GEE错误集等专栏

    GEE训练教程——如何确定几何形状的中心点坐标和相交的坐标

    首先,使用.geometry()方法获取几何形状的几何信息,然后使用.centroid()方法获取几何形状的中心点坐标。 示例代码如下: // 获取几何形状的中心点坐标 var geometry = ee.Geometry.Point([1, 2]); // 替换为你的几何形状 var center = geometry.centroid 函数 centroid(maxError, proj) Returns a point at the center of the highest-dimension components of the Lower-dimensional components are ignored, so the centroid of a geometry containing two polygons, three lines and a point is equivalent to the centroid of a geometry containing just the two polygons.

    62210编辑于 2024-06-11
  • 来自专栏Python编程 pyqt matplotlib

    K-均值算法(二)

    '''随机创建簇中心,特征数n x k 大小的矩阵 ''' n = shape(dataSet)[1] centroids = mat(zeros((k,n)))#create centroid #get all the point in this cluster centroids[cent,:] = mean(ptsInClust, axis=0) #assign centroid = mean(dataSet, axis=0).tolist()[0] centList =[centroid0] #create a list with one centroid for j in range(m):#calc initial Error clusterAssment[j,1] = distMeas(mat(centroid0), dataSet[j,: : ', len(bestClustAss)) centList[bestCentToSplit] = bestNewCents[0,:].tolist()[0]#replace a centroid

    83520发布于 2019-08-14
  • 来自专栏听雨堂

    从MapX到MapXtreme2004[8]-加入文字

    System.Drawing.Color.Red; sty2.Font.TextEffect=TextEffect.Halo; DRect drect=new DRect(ftr.Geometry.Centroid.x +2,ftr.Geometry.Centroid.y,ftr.Geometry.Centroid.x+30,ftr.Geometry.Centroid.y+12); LegacyText

    75880发布于 2018-01-23
  • 来自专栏翻译scikit-learn Cookbook

    Using KMeans for outlier detection使用KMeans进行异常值检测

    of the clusters, and then identifying points that are potential outliers by their distances from the centroid generate a single blob of 100 points, and then we'll identify the 5 points that are furthest from the centroid 'Points') ax.scatter(kmeans.cluster_centers_[:, 0],kmeans.cluster_centers_[:, 1], marker='*',label='Centroid , 1], label='Points') ax.scatter(kmeans.cluster_centers_[:, 0],kmeans.cluster_centers_[:, 1],label='Centroid Let's create an empirical Gaussian based off the centroid and sample covariance matrix and look at the

    2.3K31发布于 2019-11-26
  • 来自专栏Y大宽

    Cytoscape插件1:Centiscape

    为了进一步证实以上,作者又分析了centroid。画了centroid vs centroid图,以显示其线性分布 ,和degree一样,也不是一致的。Ucco用自己的数据画了这个图,看上面右图。 平均centroid是-393,242个点(206个激酶,36个磷酸化酶)比平均centroid高。Top10的centroid值的是(-79-18)全是激酶,还是MAPK1最高(18)。 PTPN1在所有磷酸化酶里有最高的centroid值(-154)(它在所有节点里排名22)。 由此,不管degree分析还是centroid分析,都显示无尺度分布,并且MAPK1和PTPN1是最关键的激酶和磷酸化酶。这个结论也可以通过话degree vs centroid图来证明。 从分析中可以看出,nodes非线性的分布非常明显,非常少的nodes在plot的第一象限(高degree高centroid)。这些nodes可以代表最重要的调节作用的激酶和磷酸化酶。

    2.9K31发布于 2019-02-25
  • 来自专栏AI研习社

    N-Shot Learning:用最少的数据训练最多的模型

    centroid_matrix = torch.cat((centroid_matrix, centroid_per_class[label])) if self.gpu: centroid_matrix = centroid_matrix.cuda() return centroid_matrix def get_query_x(self, Query image to each centroid. """ centroid_matrix = self.get_centroid_matrix(centroid_per_class centroid_matrix = centroid_matrix.expand(m, centroid_matrix.size(0), centroid_matrix.size(1)) # Expanding centroid matrix to "m".

    1.8K30发布于 2019-09-25
  • 来自专栏开发 & 算法杂谈

    凸包问题之GrahamScan解法

    直角坐标转化为极坐标 */ void PointToPolar(struct Point * ptArray,struct Polar *prArray,int length,struct Point centroid ) { for(int i=0;i<length;i++) { //在极坐标横轴上 if(ptArray[i].y==centroid.y) { if(ptArray[i].x>=centroid.x ) prArray[i].angle=0; else prArray[i].angle=180; } //90度 else if(ptArray[i].x==centroid.x ) prArray[i].angle=90; //其他 else prArray[i].angle=arctan(ptArray[i],centroid); //长度暂时不用 =ChooseCentroid(pArray,length); //直角坐标转化为极坐标 PointToPolar(pArray,prArray,length,centroid); //极坐标排序

    83940发布于 2018-08-02
  • 来自专栏foochane

    聚类(Clustering) K-means算法

    def updateLabels(dataSet, centroids): # For each element in the dataset, chose the closest centroid # Make that centroid the element's label. def getCentroids(dataSet, k): # Each centroid is the geometric mean of the points that # have that centroid's label. Important: If a centroid is empty (no points have # that centroid's label) you should randomly re-initialize

    78710发布于 2019-05-23
  • 来自专栏后端技术

    研究生 HW1

    Which point do you expect the centroid to be? (0.5, 0.5) 2.What objective does the centroid of the points optimize? 应当让中心点与所有点的欧式距离最小 ? return sum(sum((c - all_points) ** 2, axis=1) ** 0.5) 3.Apply gradient descent (GD) to find the centroid 4.Apply stochastic gradient descent (SGD) to find the centroid.

    70920发布于 2019-10-08
领券