@Override public Vector apply(org.apache.mahout.math.neighborhood.HashedVector input) { Preconditions.checkNotNull(input); //noinspection ConstantConditions return input.getVector(); } });
@Override public Vector apply(org.apache.mahout.math.neighborhood.HashedVector input) { Preconditions.checkNotNull(input); //noinspection ConstantConditions return input.getVector(); } });
@Override public Vector apply(org.apache.mahout.math.neighborhood.HashedVector input) { Preconditions.checkNotNull(input); //noinspection ConstantConditions return input.getVector(); } });
@Override public String toString() { return String.format("index=%d, hash=%08x, v=%s", getIndex(), hash, getVector()); }
@Override public String toString() { return String.format("index=%d, hash=%08x, v=%s", getIndex(), hash, getVector()); }
@Override public String toString() { return String.format("index=%d, hash=%08x, v=%s", getIndex(), hash, getVector()); }
@Override public List<WeightedThing<Vector>> search(Vector query, int limit) { PriorityQueue<WeightedThing<Vector>> top = searchInternal(query); List<WeightedThing<Vector>> results = Lists.newArrayListWithExpectedSize(top.size()); while (top.size() != 0) { WeightedThing<Vector> wv = top.pop(); results.add(new WeightedThing<Vector>(((HashedVector) wv.getValue()).getVector(), wv.getWeight())); } Collections.reverse(results); if (limit < results.size()) { results = results.subList(0, limit); } return results; }
@Override public List<WeightedThing<Vector>> search(Vector query, int limit) { PriorityQueue<WeightedThing<Vector>> top = searchInternal(query); List<WeightedThing<Vector>> results = Lists.newArrayListWithExpectedSize(top.size()); while (top.size() != 0) { WeightedThing<Vector> wv = top.pop(); results.add(new WeightedThing<Vector>(((HashedVector) wv.getValue()).getVector(), wv.getWeight())); } Collections.reverse(results); if (limit < results.size()) { results = results.subList(0, limit); } return results; }
@Override public List<WeightedThing<Vector>> search(Vector query, int limit) { PriorityQueue<WeightedThing<Vector>> top = searchInternal(query); List<WeightedThing<Vector>> results = Lists.newArrayListWithExpectedSize(top.size()); while (top.size() != 0) { WeightedThing<Vector> wv = top.pop(); results.add(new WeightedThing<>(((HashedVector) wv.getValue()).getVector(), wv.getWeight())); } Collections.reverse(results); if (limit < results.size()) { results = results.subList(0, limit); } return results; }
protected static WeightedThing<Vector> removeHash(WeightedThing<Vector> input) { return new WeightedThing<>(((HashedVector) input.getValue()).getVector(), input.getWeight()); }
protected static WeightedThing<Vector> removeHash(WeightedThing<Vector> input) { return new WeightedThing<Vector>(((HashedVector) input.getValue()).getVector(), input.getWeight()); }
protected static WeightedThing<Vector> removeHash(WeightedThing<Vector> input) { return new WeightedThing<Vector>(((HashedVector) input.getValue()).getVector(), input.getWeight()); }