@Override protected MutableElement getSentinelObject() { return new MutableElement(SENTINEL_INDEX, Double.MIN_VALUE); }
public static void write(Vector vector, Path path, Configuration conf) throws IOException { write(vector, path, conf, false); }
public List<MutableElement> getTopElements() { List<MutableElement> topElements = Lists.newArrayListWithCapacity(maxSize); while (size() > 0) { MutableElement top = pop(); // filter out "sentinel" objects necessary for maintaining an efficient priority queue if (top.index() != SENTINEL_INDEX) { topElements.add(top); } } Collections.reverse(topElements); return topElements; }
@Override protected void reduce(IntWritable row, Iterable<VectorWritable> partials, Context ctx) throws IOException, InterruptedException { Vector allSimilarities = Vectors.merge(partials); Vector topKSimilarities = Vectors.topKElements(maxSimilaritiesPerRow, allSimilarities); ctx.write(row, new VectorWritable(topKSimilarities)); } }
public static void main(String[] args) throws Exception { ToolRunner.run(new RowSimilarityJob(), args); }
@Override protected void reduce(IntWritable row, Iterable<VectorWritable> partialVectors, Context ctx) throws IOException, InterruptedException { ctx.write(row, new VectorWritable(Vectors.merge(partialVectors))); } }
public List<MutableElement> getTopElements() { List<MutableElement> topElements = Lists.newArrayListWithCapacity(maxSize); while (size() > 0) { MutableElement top = pop(); // filter out "sentinel" objects necessary for maintaining an efficient priority queue if (top.index() != SENTINEL_INDEX) { topElements.add(top); } } Collections.reverse(topElements); return topElements; }
@Override protected void reduce(IntWritable row, Iterable<VectorWritable> partials, Context ctx) throws IOException, InterruptedException { Vector allSimilarities = Vectors.merge(partials); Vector topKSimilarities = Vectors.topKElements(maxSimilaritiesPerRow, allSimilarities); ctx.write(row, new VectorWritable(topKSimilarities)); } }
public static void main(String[] args) throws Exception { ToolRunner.run(new RowSimilarityJob(), args); }
@Override protected MutableElement getSentinelObject() { return new MutableElement(SENTINEL_INDEX, Double.MIN_VALUE); }
public static void write(Vector vector, Path path, Configuration conf) throws IOException { write(vector, path, conf, false); }
@Override protected void reduce(IntWritable row, Iterable<VectorWritable> partialVectors, Context ctx) throws IOException, InterruptedException { ctx.write(row, new VectorWritable(Vectors.merge(partialVectors))); } }
public List<MutableElement> getTopElements() { List<MutableElement> topElements = Lists.newArrayListWithCapacity(maxSize); while (size() > 0) { MutableElement top = pop(); // filter out "sentinel" objects necessary for maintaining an efficient priority queue if (top.index() != SENTINEL_INDEX) { topElements.add(top); } } Collections.reverse(topElements); return topElements; }
public static void main(String[] args) throws Exception { ToolRunner.run(new RowSimilarityJob(), args); }
@Override protected MutableElement getSentinelObject() { return new MutableElement(SENTINEL_INDEX, Double.MIN_VALUE); }
public static void write(Vector vector, Path path, Configuration conf) throws IOException { write(vector, path, conf, false); }
@Override protected void reduce(IntWritable row, Iterable<VectorWritable> partialVectors, Context ctx) throws IOException, InterruptedException { ctx.write(row, new VectorWritable(Vectors.merge(partialVectors))); } }