I'm trying to use DBSCANClusterer from apache.commons.math3.ml.clustering package with no success. I'm using Apache Common Math 3.4.1
When I run the DBSCANClusterer.cluster() method I always get one cluster with one point, which always corresponds to the first point in my list of Points.
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));
}
}
My output is always: [1009.0, 1019.0] . What am I doing wrong here?