@Test public void testEigenSeedGenerator() throws Exception { List<VectorWritable> points = getPoints(); Job job = new Job(); Configuration conf = job.getConfiguration(); job.setMapOutputValueClass(VectorWritable.class); Path input = getTestTempFilePath("eigen-input"); Path output = getTestTempDirPath("eigen-output"); ClusteringTestUtils.writePointsToFile(points, input, fs, conf); EigenSeedGenerator.buildFromEigens(conf, input, output, 3, new ManhattanDistanceMeasure()); int clusterCount = 0; Collection<Integer> set = new HashSet<>(); Vector v[] = new Vector[3]; for (ClusterWritable clusterWritable : new SequenceFileValueIterable<ClusterWritable>( new Path(output, "part-eigenSeed"), true, conf)) { Cluster cluster = clusterWritable.getValue(); int id = cluster.getId(); assertTrue(set.add(id)); v[id] = cluster.getCenter(); clusterCount++; } assertEquals(3, clusterCount); assertEquals(0, v[0].dot(v[1]), 1E-10); assertEquals(0, v[1].dot(v[2]), 1E-10); assertEquals(0, v[0].dot(v[2]), 1E-10); }
private EigenSeedGenerator() {}
EigenSeedGenerator { private EigenSeedGenerator() {} }
EigenSeedGenerator { private EigenSeedGenerator() {} private  EigenSeedGenerator(); }
EigenSeedGenerator { private EigenSeedGenerator() {} private  EigenSeedGenerator(); static Path buildFromEigens(Configuration conf, Path input, Path output, int k, DistanceMeasure measure); }
EigenSeedGenerator { private EigenSeedGenerator() {} private  EigenSeedGenerator(); static Path buildFromEigens(Configuration conf, Path input, Path output, int k, DistanceMeasure measure); static final String K; }