@Override public void map(IntWritable key, WeightedVectorWritable val, Context context) throws IOException, InterruptedException { // by pivoting on the cluster mapping value, we can make sure that each unique cluster goes to it's own reducer, // since they are numbered from 0 to k-1, where k is the number of clusters outputVector.set(val.getVector()); context.write(new IntWritable(newClusterMappings.get(key.get())), outputVector); } }
@Override public void map(IntWritable key, WeightedVectorWritable val, Context context) throws IOException, InterruptedException { // by pivoting on the cluster mapping value, we can make sure that each unique cluster goes to it's own reducer, // since they are numbered from 0 to k-1, where k is the number of clusters outputVector.set(val.getVector()); context.write(new IntWritable(newClusterMappings.get(key.get())), outputVector); } }
@Override public void map(IntWritable key, WeightedVectorWritable val, Context context) throws IOException, InterruptedException { // by pivoting on the cluster mapping value, we can make sure that each unique cluster goes to it's own reducer, // since they are numbered from 0 to k-1, where k is the number of clusters outputVector.set(val.getVector()); context.write(new IntWritable(newClusterMappings.get(key.get())), outputVector); } }
/** * Writes vector to the cluster directory. */ private void writeVectorToCluster(Writer writer, WeightedVectorWritable point) throws IOException { writer.append(new LongWritable(uniqueVectorId++), new VectorWritable(point.getVector())); writer.sync(); }
/** * Writes vector to the cluster directory. */ private void writeVectorToCluster(Writer writer, WeightedVectorWritable point) throws IOException { writer.append(new LongWritable(uniqueVectorId++), new VectorWritable(point.getVector())); writer.sync(); }
/** * Writes vector to the cluster directory. */ private void writeVectorToCluster(Writer writer, WeightedVectorWritable point) throws IOException { writer.append(new LongWritable(uniqueVectorId++), new VectorWritable(point.getVector())); writer.sync(); }