@Override public LongNearestNeighboursKDTree create(long[][] data) { return new LongNearestNeighboursKDTree(data, ntrees, nchecks); } }
@Override public LongNearestNeighboursKDTree create(long[][] data) { return new LongNearestNeighboursKDTree(data, ntrees, nchecks); } }
/** * Construct the assigner using the given cluster data. * * @param data the cluster data */ public KDTreeLongEuclideanAssigner(long[][] data) { 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 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. * * @param provider the cluster data provider */ public KDTreeLongEuclideanAssigner(CentroidsProvider<long[]> provider) { 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); }
/** * 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); } }