@Test public void testBuildRandomSeededSameInitalClusters() 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); long randSeed=1; RandomSeedGenerator.buildRandom(conf, input, output, 4, new ManhattanDistanceMeasure(), randSeed); int[] clusterIDSeq = new int[4]; int clusterCount = 0; for (ClusterWritable clusterWritable : new SequenceFileValueIterable<ClusterWritable>(new Path(output, "part-randomSeed"), true, conf)) { Cluster cluster = clusterWritable.getValue(); clusterIDSeq[clusterCount] = cluster.getId(); clusterCount++; } RandomSeedGenerator.buildRandom(conf, input, output, 4, new ManhattanDistanceMeasure(), randSeed); clusterCount = 0; for (ClusterWritable clusterWritable : new SequenceFileValueIterable<ClusterWritable>(new Path(output, "part-randomSeed"), true, conf)) { Cluster cluster = clusterWritable.getValue(); assertEquals(clusterIDSeq[clusterCount], cluster.getId()); 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; }