initialize();
this.setTitle("Spectral k-Means Clusters (>" + (int) (significance * 100) + "% of population)");
}
public static void main(String[] args) throws Exception {
DistanceMeasure measure = new ManhattanDistanceMeasure();
Path samples = new Path("samples");
Path output = new Path("output");
HadoopUtil.overwriteOutput(samples);
HadoopUtil.overwriteOutput(output);
RandomUtils.useTestSeed();
DisplayClustering.generateSamples();
writeSampleData(samples);
int maxIter = 10;
double convergenceDelta = 0.001;
Path affinities = new Path(output, "affinities");
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(output.toUri(), conf);
if (!fs.exists(output)) {
fs.mkdirs(output);
}
FileWriter writer = new FileWriter(affinities.toString());
PrintWriter out = new PrintWriter(writer);
try {
for (int i = 0; i < SAMPLE_DATA.size(); i++) {
for (int j = 0; j < SAMPLE_DATA.size(); j++) {
out.println(i + "," + j + "," + measure.distance(SAMPLE_DATA.get(i).get(), SAMPLE_DATA.get(j).get()));
}
}
} finally {
out.close();
}