I want to cluster points specified by latitude and longitude. I am using WEKA API
The problem is with Instances instances = new Instances(40.01,1.02);
So, how to specify input data without using ARFF file? I would like just to read an array into Instances
.
import java.io.Reader;
import weka.clusterers.ClusterEvaluation;
import weka.clusterers.SimpleKMeans;
import weka.core.Instances;
public class test {
/**
* @param args
*/
public static void main(String[] args) {
Instances instances = new Instances(40.01,1.02);
SimpleKMeans simpleKMeans = new SimpleKMeans();
simpleKMeans.buildClusterer(instances);
ClusterEvaluation eval = new ClusterEvaluation();
eval.setClusterer(simpleKMeans);
eval.evaluateClusterer(new Instances(instances));
eval.clusterResultsToString();
}
}
I believe you have to create your own instances. Below I show creating a new instances from an array with two attributes, latitude and longitude.