Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(pointsPath.toUri(), conf);
List<VectorWritable> points = TestKmeansClustering.getPointsWritable(TestKmeansClustering.REFERENCE);
ClusteringTestUtils.writePointsToFile(points, new Path(pointsPath, "file1"), fs, conf);
Path path = new Path(priorPath, "priorClassifier");
ClusterClassifier prior = newKlusterClassifier();
prior.writeToSeqFiles(path);
ClusteringPolicy policy = new KMeansClusteringPolicy();
ClusterClassifier.writePolicy(policy, path);
assertEquals(3, prior.getModels().size());
System.out.println("Prior");
for (Cluster cluster : prior.getModels()) {
System.out.println(cluster.asFormatString(null));
}
new ClusterIterator().iterateMR(conf, pointsPath, path, outPath, 5);
for (int i = 1; i <= 4; i++) {
System.out.println("Classifier-" + i);
ClusterClassifier posterior = new ClusterClassifier();
String name = i == 4 ? "clusters-4-final" : "clusters-" + i;
posterior.readFromSeqFiles(conf, new Path(outPath, name));
assertEquals(3, posterior.getModels().size());
for (Cluster cluster : posterior.getModels()) {
System.out.println(cluster.asFormatString(null));
}
}
}