@Override public ByteNearestNeighboursExact create(byte[][] data) { return new ByteNearestNeighboursExact(data, distance); } }
/** * Construct the assigner using the given cluster data and * distance function. * * @param data the cluster data * @param comparison the distance function */ public ExactByteAssigner(byte[][] data, ByteFVComparator comparison) { nn = new ByteNearestNeighboursExact(data, comparison); }
@Override public ByteNearestNeighboursExact create(byte[][] data) { return new ByteNearestNeighboursExact(data, distance); } }
/** * Construct the assigner using the given cluster data and * distance function. The assigner will operate in exact mode, * using a {@link ByteNearestNeighboursExact}. * * @param data the cluster data * @param comparison the distance function * @param numNeighbours the number of nearest neighbours to select. */ public ByteKNNAssigner(byte[][] data, ByteFVComparison comparison, int numNeighbours) { this.numNeighbours = numNeighbours; nn = new ByteNearestNeighboursExact(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 ExactByteAssigner(CentroidsProvider<byte[]> provider, ByteFVComparator comparison) { nn = new ByteNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data and * distance function. The assigner will operate in exact mode, * using a {@link ByteNearestNeighboursExact}. * * @param provider the cluster data provider * @param comparison the distance function * @param numNeighbours the number of nearest neighbours to select. */ public ByteKNNAssigner(CentroidsProvider<byte[]> provider, ByteFVComparison comparison, int numNeighbours) { this.numNeighbours = numNeighbours; nn = new ByteNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data. The assigner * is backed by either a {@link ByteNearestNeighboursExact} or * {@link ByteNearestNeighboursKDTree}, depending on whether the exact * parameter is true or false. If the parameter is true, then the * resultant {@link ByteNearestNeighboursExact} 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 ByteKNNAssigner(byte[][] data, boolean exact, int numNeighbours) { this.numNeighbours = numNeighbours; if (exact) { nn = new ByteNearestNeighboursExact(data); } else { nn = new ByteNearestNeighboursKDTree(data, ByteNearestNeighboursKDTree.DEFAULT_NTREES, ByteNearestNeighboursKDTree.DEFAULT_NCHECKS); } }
/** * Construct the assigner using the given cluster data. The assigner * is backed by either a {@link ByteNearestNeighboursExact} or * {@link ByteNearestNeighboursKDTree}, depending on whether the exact * parameter is true or false. If the parameter is true, then the * resultant {@link ByteNearestNeighboursExact} 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 ByteKNNAssigner(CentroidsProvider<byte[]> provider, boolean exact, int numNeighbours) { this.numNeighbours = numNeighbours; if (exact) { nn = new ByteNearestNeighboursExact(provider.getCentroids()); } else { if (provider instanceof ByteNearestNeighboursProvider) { ByteNearestNeighbours internal = ((ByteNearestNeighboursProvider)provider).getNearestNeighbours(); if (internal != null && internal instanceof ByteNearestNeighboursKDTree) { nn = (ByteNearestNeighboursKDTree) internal; return; } } nn = new ByteNearestNeighboursKDTree(provider.getCentroids(), ByteNearestNeighboursKDTree.DEFAULT_NTREES, ByteNearestNeighboursKDTree.DEFAULT_NCHECKS); } }