Hi, I would like to get info about RADIUS and CENTERS for each my cluster. Could you tell me how I can do it?
I have got this piece of code and I would like to do it in the WHILE loop in the end. Thank you in advance public static Map<String, ClusterPack> calculate(int numbOfClusters, String filename, List<String> headers) throws IOException, InterruptedException, ClassNotFoundException { Map<String, ClusterPack> toReturn = new HashMap<String, ClusterPack>(); int k = numbOfClusters; List<Vector> vectors = getPointsFromFile(filename); File testData = new File("testdata"); if (!testData.exists()) { testData.mkdir(); } testData = new File("testdata/points"); if (!testData.exists()) { testData.mkdir(); } Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(conf); ClusterHelper.writePointsToFile(vectors, conf, new Path( "testdata/points/file1")); Path path = new Path("testdata/clusters/part-00000"); SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, path, Text.class, Kluster.class); for (int i = 0; i < k; i++) { Vector vec = vectors.get(i); Kluster cluster = new Kluster(vec, i, new EuclideanDistanceMeasure()); writer.append(new Text(cluster.getIdentifier()), cluster); } writer.close(); Path output = new Path("output"); HadoopUtil.delete(conf, output); KMeansDriver.run(conf, new Path("testdata/points"), new Path( "testdata/clusters"), output, 0.001, 10, true, 0.0, false); SequenceFile.Reader reader = new SequenceFile.Reader(fs, new Path( "output/" + Kluster.CLUSTERED_POINTS_DIR + "/part-m-00000"), conf); IntWritable key = new IntWritable(); WeightedVectorWritable value = new WeightedPropertyVectorWritable(); while (reader.next(key, value)) { // ADD SOMETHING HERE !!! }