@Test public void testRandomSeedGeneratorSeeded() throws Exception { List<VectorWritable> points = getPoints(); Job job = new Job(); Configuration conf = job.getConfiguration(); job.setMapOutputValueClass(VectorWritable.class); Path input = getTestTempFilePath("random-input"); Path output = getTestTempDirPath("random-output"); ClusteringTestUtils.writePointsToFile(points, input, fs, conf); RandomSeedGenerator.buildRandom(conf, input, output, 4, new ManhattanDistanceMeasure(), 1L); int clusterCount = 0; Collection<Integer> set = Sets.newHashSet(); for (ClusterWritable clusterWritable : new SequenceFileValueIterable<ClusterWritable>(new Path(output, "part-randomSeed"), true, conf)) { clusterCount++; Cluster cluster = clusterWritable.getValue(); int id = cluster.getId(); assertTrue(set.add(id)); Vector v = cluster.getCenter(); assertVectorEquals(RAW[id], v); } assertEquals(4, clusterCount); }
public static Path buildRandom(Configuration conf, Path input, Path output, int k, DistanceMeasure measure) throws IOException { return buildRandom(conf, input, output, k, measure, null); }
RandomSeedGenerator { public static Path buildRandom(Configuration conf, Path input, Path output, int k, DistanceMeasure measure) throws IOException { return buildRandom(conf, input, output, k, measure, null); } }
RandomSeedGenerator { public static Path buildRandom(Configuration conf, Path input, Path output, int k, DistanceMeasure measure) throws IOException { return buildRandom(conf, input, output, k, measure, null); } private  RandomSeedGenerator(); }
RandomSeedGenerator { public static Path buildRandom(Configuration conf, Path input, Path output, int k, DistanceMeasure measure) throws IOException { return buildRandom(conf, input, output, k, measure, null); } private  RandomSeedGenerator(); static Path buildRandom(Configuration conf, Path input, Path output, int k, DistanceMeasure measure); static Path buildRandom(Configuration conf,
                                 Path input,
                                 Path output,
                                 int k,
                                 DistanceMeasure measure,
                                 Long seed); }
RandomSeedGenerator { public static Path buildRandom(Configuration conf, Path input, Path output, int k, DistanceMeasure measure) throws IOException { return buildRandom(conf, input, output, k, measure, null); } private  RandomSeedGenerator(); static Path buildRandom(Configuration conf, Path input, Path output, int k, DistanceMeasure measure); static Path buildRandom(Configuration conf,
                                 Path input,
                                 Path output,
                                 int k,
                                 DistanceMeasure measure,
                                 Long seed); static final String K; }