-1

我正在尝试使用 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] 。我在这里做错了什么?

4

2 回答 2

0

您的第一个“集群”可能是噪音集群。使用您的参数,所有数据都是噪声,因此您只会得到一个包含所有点的集群。

于 2015-03-30T15:29:04.557 回答
0

当您为每个点重复使用 foo 数组时,您会创建 1000 个相同的点。

于 2015-06-19T13:02:36.557 回答