我正在尝试使用 apache.commons.math3.ml.clustering 包中的 DBSCANClusterer,但没有成功。我正在使用 Apache Common Math 3.4.1
当我运行 DBSCANClusterer.cluster() 方法时,我总是得到一个带有一个点的集群,它始终对应于我的点列表中的第一个点。
public static void main(String[] args)
{
DBSCANClusterer dbscan = new DBSCANClusterer(.9,2);
List<DoublePoint> points = new ArrayList<DoublePoint>();
double[] foo = new double[2];
int i = 0;
for (i =0; i<1000 ; i++)
{
foo[0] = 10 + i;
foo[1] = 20 + i;
points.add(new DoublePoint(foo));
}
List<Cluster<DoublePoint>> cluster = dbscan.cluster(points);
// My output here is always: [1009 , 1019]
for(Cluster<DoublePoint> c: cluster){
System.out.println(c.getPoints().get(0));
}
}
我的输出总是: [1009.0, 1019.0] 。我在这里做错了什么?