[英]Value at KMeans.cluster_centers_ in sklearn KMeans
On doing K means fit on some vectors with 3 clusters, I was able to get the labels for the input data. 在做K表示适合具有3个聚类的某些矢量时,我能够获得输入数据的标签。
KMeans.cluster_centers_
returns the coordinates of the centers and so shouldn't there be some vector corresponding to that? KMeans.cluster_centers_
返回中心的坐标,因此不应该有一些与之相对应的矢量吗? How can I find the value at the centroid of these clusters? 如何在这些聚类的质心处找到值?
closest, _ = pairwise_distances_argmin_min(KMeans.cluster_centers_, X)
The array closest
will contain the index of the point in X that is closest to each centroid. closest
的数组将包含X中最接近每个质心的点的索引。
Let's say the closest
gave output as array([0,8,5])
for the three clusters. 假设三个簇的
closest
输出为array([0,8,5])
。 So X[0] is the closest point in X to centroid 0, and X[8] is the closest to centroid 1 and so on. 因此,X [0]是X中最接近质心0的点,X [8]是最接近质心1的点,依此类推。
Source: https://codedump.io/share/XiME3OAGY5Tm/1/get-nearest-point-to-centroid-scikit-learn 资料来源: https : //codedump.io/share/XiME3OAGY5Tm/1/get-nearest-point-to-centroid-scikit-learn
The cluster centre value is the value of the centroid. 聚类中心值是质心的值。 At the end of k-means clustering, you'll have three individual clusters and three centroids, with each centroid being located at the centre of each cluster.
在k均值聚类结束时,您将拥有三个单独的聚类和三个质心,每个质心位于每个聚类的中心。 The centroid doesn't necessarily have to coincide with an existing data point.
重心不一定必须与现有数据点重合。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.