@Override public LongNearestNeighboursExact create(long[][] data) { return new LongNearestNeighboursExact(data, distance); } }
/** * Construct the assigner using the given cluster data and * distance function. * * @param data the cluster data * @param comparison the distance function */ public ExactLongAssigner(long[][] data, LongFVComparator comparison) { nn = new LongNearestNeighboursExact(data, comparison); }
@Override public LongNearestNeighboursExact create(long[][] data) { return new LongNearestNeighboursExact(data, distance); } }
/** * Construct the assigner using the given cluster data and * distance function. The assigner will operate in exact mode, * using a {@link LongNearestNeighboursExact}. * * @param data the cluster data * @param comparison the distance function * @param numNeighbours the number of nearest neighbours to select. */ public LongKNNAssigner(long[][] data, LongFVComparison comparison, int numNeighbours) { this.numNeighbours = numNeighbours; nn = new LongNearestNeighboursExact(data, comparison); }
/** * Construct the assigner using the given cluster data and * distance function. * * @param provider the cluster data provider * @param comparison the distance function */ public ExactLongAssigner(CentroidsProvider<long[]> provider, LongFVComparator comparison) { nn = new LongNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data and * distance function. The assigner will operate in exact mode, * using a {@link LongNearestNeighboursExact}. * * @param provider the cluster data provider * @param comparison the distance function * @param numNeighbours the number of nearest neighbours to select. */ public LongKNNAssigner(CentroidsProvider<long[]> provider, LongFVComparison comparison, int numNeighbours) { this.numNeighbours = numNeighbours; nn = new LongNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data. The assigner * is backed by either a {@link LongNearestNeighboursExact} or * {@link LongNearestNeighboursKDTree}, depending on whether the exact * parameter is true or false. If the parameter is true, then the * resultant {@link LongNearestNeighboursExact} will use Euclidean * distance. * * @param data the cluster data * @param exact if true, then use exact mode; false implies approximate mode. * @param numNeighbours the number of nearest neighbours to select. */ public LongKNNAssigner(long[][] data, boolean exact, int numNeighbours) { this.numNeighbours = numNeighbours; if (exact) { nn = new LongNearestNeighboursExact(data); } else { nn = new LongNearestNeighboursKDTree(data, LongNearestNeighboursKDTree.DEFAULT_NTREES, LongNearestNeighboursKDTree.DEFAULT_NCHECKS); } }
/** * Construct the assigner using the given cluster data. The assigner * is backed by either a {@link LongNearestNeighboursExact} or * {@link LongNearestNeighboursKDTree}, depending on whether the exact * parameter is true or false. If the parameter is true, then the * resultant {@link LongNearestNeighboursExact} will use Euclidean * distance. * * @param provider the cluster data provider * @param exact if true, then use exact mode; false implies approximate mode. * @param numNeighbours the number of nearest neighbours to select. */ public LongKNNAssigner(CentroidsProvider<long[]> provider, boolean exact, int numNeighbours) { this.numNeighbours = numNeighbours; if (exact) { nn = new LongNearestNeighboursExact(provider.getCentroids()); } else { if (provider instanceof LongNearestNeighboursProvider) { LongNearestNeighbours internal = ((LongNearestNeighboursProvider)provider).getNearestNeighbours(); if (internal != null && internal instanceof LongNearestNeighboursKDTree) { nn = (LongNearestNeighboursKDTree) internal; return; } } nn = new LongNearestNeighboursKDTree(provider.getCentroids(), LongNearestNeighboursKDTree.DEFAULT_NTREES, LongNearestNeighboursKDTree.DEFAULT_NCHECKS); } }