简体   繁体   English

3D平面中的聚类点

[英]Clustering points in 3D plane

Suppose we have 1000 random data points in a cube (as shown in the following image). 假设我们在一个立方体中有1000个随机数据点(如下图所示)。 The distribution of points in X and Y directions are uniform but not in Z direction. X和Y方向上的点分布是均匀的,但Z方向不是。 As we get deeper, the data points are denser. 随着我们的深入,数据点也越来越密集。 Is there any straightforward way in python to cluster these data points such that: python中是否有任何简单的方法来聚类这些数据点,使得:

  • each cluster has equal size 每个集群的大小相等
  • each cluster consists of local points, ie, each cluster consists of points being close to each other. 每个聚类由局部点组成,即,每个聚类由彼此靠近的点组成。

I have already tried K-means clustering from Scipy package but it did not give me a good result and the points of each cluster were very widespread rather than being concentrated. 我已经从Scipy包中尝试了K-means聚类,但是它并没有给我带来很好的结果,并且每个聚类的要点都非常广泛,而不是集中。

在此处输入图片说明

Try using Scikit-Learn's implementation. 尝试使用Scikit-Learn的实现。 They initialize their clusters using a technique known as "K-Means++" which picks the first means probabilistically to get an optimal starting distribution. 他们使用称为“ K-Means ++”的技术初始化集群,该技术概率性地选择了第一种方法以获得最佳的初始分布。 This creates a higher probability of a good result. 这产生了较高的获得良好结果的可能性。

http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html http://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM