/** * Construct with the given assigner and the centroids associated with the * assigner. * * @param assigner * the assigner * @param centroids * the centroids associated with the assigner * @param normalise * if true then output feature is l2 normalised */ public VLAD(HardAssigner<T, ?, ?> assigner, CentroidsProvider<T> centroids, boolean normalise) { this(assigner, centroids.getCentroids(), normalise); }
/** * Construct with the given assigner and the centroids associated with the * assigner. * * @param assigner * the assigner * @param centroids * the centroids associated with the assigner * @param normalise * if true then output feature is l2 normalised */ public VLAD(HardAssigner<T, ?, ?> assigner, CentroidsProvider<T> centroids, boolean normalise) { this(assigner, centroids.getCentroids(), normalise); }
/** * Construct the assigner using the given cluster data and * distance function. * * @param provider the cluster data provider * @param comparison the distance function */ public ExactDoubleAssigner(CentroidsProvider<double[]> provider, DoubleFVComparator comparison) { nn = new DoubleNearestNeighboursExact(provider.getCentroids(), 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. * * @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. * * @param provider the cluster data provider * @param comparison the distance function */ public ExactIntAssigner(CentroidsProvider<int[]> provider, IntFVComparator comparison) { nn = new IntNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data and * distance function. The assigner will operate in exact mode, * using a {@link ShortNearestNeighboursExact}. * * @param provider the cluster data provider * @param comparison the distance function * @param numNeighbours the number of nearest neighbours to select. */ public ShortKNNAssigner(CentroidsProvider<short[]> provider, ShortFVComparison comparison, int numNeighbours) { this.numNeighbours = numNeighbours; nn = new ShortNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data and * distance function. * * @param provider the cluster data provider * @param comparison the distance function */ public ExactFloatAssigner(CentroidsProvider<float[]> provider, FloatFVComparator comparison) { nn = new FloatNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data and * distance function. * * @param provider the cluster data provider * @param comparison the distance function */ public ExactShortAssigner(CentroidsProvider<short[]> provider, ShortFVComparator comparison) { nn = new ShortNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data and * distance function. The assigner will operate in exact mode, * using a {@link DoubleNearestNeighboursExact}. * * @param provider the cluster data provider * @param comparison the distance function * @param numNeighbours the number of nearest neighbours to select. */ public DoubleKNNAssigner(CentroidsProvider<double[]> provider, DoubleFVComparison comparison, int numNeighbours) { this.numNeighbours = numNeighbours; nn = new DoubleNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data and * distance function. The assigner will operate in exact mode, * using a {@link FloatNearestNeighboursExact}. * * @param provider the cluster data provider * @param comparison the distance function * @param numNeighbours the number of nearest neighbours to select. */ public FloatKNNAssigner(CentroidsProvider<float[]> provider, FloatFVComparison comparison, int numNeighbours) { this.numNeighbours = numNeighbours; nn = new FloatNearestNeighboursExact(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 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 and * distance function. The assigner will operate in exact mode, * using a {@link IntNearestNeighboursExact}. * * @param provider the cluster data provider * @param comparison the distance function * @param numNeighbours the number of nearest neighbours to select. */ public IntKNNAssigner(CentroidsProvider<int[]> provider, IntFVComparison comparison, int numNeighbours) { this.numNeighbours = numNeighbours; nn = new IntNearestNeighboursExact(provider.getCentroids(), comparison); }
/** * Construct the assigner using the given cluster data and distance * function. * * @param provider * the cluster data provider * @param comparison * the distance function */ @SuppressWarnings("unchecked") public ExactFeatureVectorAssigner(CentroidsProvider<T> provider, DistanceComparator<? super T> comparison) { final T[] centroids = provider.getCentroids(); nn = new ObjectNearestNeighboursExact<T>(centroids, comparison); this.ndims = centroids[0].length(); this.clz = (Class<T>) centroids.getClass().getComponentType(); }
/** * Construct the assigner using the given cluster data. * * @param provider the cluster data provider */ public KDTreeShortEuclideanAssigner(CentroidsProvider<short[]> provider) { if (provider instanceof ShortNearestNeighboursProvider) { ShortNearestNeighbours internal = ((ShortNearestNeighboursProvider)provider).getNearestNeighbours(); if (internal != null && internal instanceof ShortNearestNeighboursKDTree) { nn = (ShortNearestNeighboursKDTree) internal; return; } } nn = new ShortNearestNeighboursKDTree(provider.getCentroids(), ShortNearestNeighboursKDTree.DEFAULT_NTREES, ShortNearestNeighboursKDTree.DEFAULT_NCHECKS); }
/** * Construct the assigner using the given cluster data. * * @param provider the cluster data provider */ public KDTreeByteEuclideanAssigner(CentroidsProvider<byte[]> provider) { 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); }
/** * Construct the assigner using the given cluster data. * * @param provider the cluster data provider */ public KDTreeDoubleEuclideanAssigner(CentroidsProvider<double[]> provider) { if (provider instanceof DoubleNearestNeighboursProvider) { DoubleNearestNeighbours internal = ((DoubleNearestNeighboursProvider)provider).getNearestNeighbours(); if (internal != null && internal instanceof DoubleNearestNeighboursKDTree) { nn = (DoubleNearestNeighboursKDTree) internal; return; } } nn = new DoubleNearestNeighboursKDTree(provider.getCentroids(), DoubleNearestNeighboursKDTree.DEFAULT_NTREES, DoubleNearestNeighboursKDTree.DEFAULT_NCHECKS); }
/** * Construct the assigner using the given cluster data. * * @param provider the cluster data provider */ public KDTreeFloatEuclideanAssigner(CentroidsProvider<float[]> provider) { if (provider instanceof FloatNearestNeighboursProvider) { FloatNearestNeighbours internal = ((FloatNearestNeighboursProvider)provider).getNearestNeighbours(); if (internal != null && internal instanceof FloatNearestNeighboursKDTree) { nn = (FloatNearestNeighboursKDTree) internal; return; } } nn = new FloatNearestNeighboursKDTree(provider.getCentroids(), FloatNearestNeighboursKDTree.DEFAULT_NTREES, FloatNearestNeighboursKDTree.DEFAULT_NCHECKS); }
/** * Construct the assigner using the given cluster data. * * @param provider the cluster data provider */ public KDTreeIntEuclideanAssigner(CentroidsProvider<int[]> provider) { if (provider instanceof IntNearestNeighboursProvider) { IntNearestNeighbours internal = ((IntNearestNeighboursProvider)provider).getNearestNeighbours(); if (internal != null && internal instanceof IntNearestNeighboursKDTree) { nn = (IntNearestNeighboursKDTree) internal; return; } } nn = new IntNearestNeighboursKDTree(provider.getCentroids(), IntNearestNeighboursKDTree.DEFAULT_NTREES, IntNearestNeighboursKDTree.DEFAULT_NCHECKS); }