アットウィキロゴ

w2w2333

package math;
 
import org.apache.commons.math3.ml.clustering.*;
import java.util.List;
import org.apache.commons.math3.geometry.partitioning.Region.Location;
import org.apache.commons.math3.ml.clustering.*;
 
class pro{
 
public static void main(String[] args) {
 
pro test=new pro();
}
 
pro(){
 
   KMeansPlusPlusClusterer<LocationWrapper> clusterer = new KMeansPlusPlusClusterer<LocationWrapper>(10, 10000);
List<CentroidCluster<LocationWrapper>> clusterResults = clusterer.cluster(clusterInput);
 
for (int i=0; i<clusterResults.size(); i++) {
    System.out.println("Cluster " + i);
    for (LocationWrapper locationWrapper : clusterResults.get(i).getPoints())
        System.out.println(locationWrapper.getLocation());
    System.out.println();
}
}
 
public static class LocationWrapper implements Clusterable {
 
    private double[] points;
    private Location location;
 
    public LocationWrapper(Location location) {
        this.location = location;
        this.points =points;
    }    
 
public Location getLocation() {
        return location;
    }
 
    public double[] getPoint() {
        return points;
    }
}
 
}
最終更新:2015年11月27日 01:30