Documentation of 'jsat.linear.vectorcollection.RandomBallCover' Java class
RandomBallCover
jsat.linear.vectorcollection

Class RandomBallCover<V extends Vec>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, IncrementalCollection<V>, VectorCollection<V>


    public class RandomBallCover<V extends Vec>
    extends java.lang.Object
    implements IncrementalCollection<V>
    An implementation of the exact search for the Random Ball Cover algorithm. Unlike most algorithms, it attempts to satisfy queries in O(sqrt(n)) time. It does this to be more efficient in its computation and easily parallelizable. Construction time is O(n3/2).
    Unlike the original paper, which assumes single queries will be run in parallel, the algorithm has been modified to perform additional pruning and to support range queries.

    See: Cayton, L. (2012). Accelerating Nearest Neighbor Search on Manycore Systems. 2012 IEEE 26th International Parallel and Distributed Processing Symposium, 402–413. doi:10.1109/IPDPS.2012.45
    See Also:
    Serialized Form
    • Constructor Detail

      • RandomBallCover

        public RandomBallCover(java.util.List<V> vecs,
                               DistanceMetric dm,
                               boolean parallel)
        Creates a new Random Ball Cover
        Parameters:
        vecs - the vectors to place into the RBC
        dm - the distance metric to use
        parallel - true if construction should be done in parallel, false for single threaded.
      • RandomBallCover

        public RandomBallCover(java.util.List<V> vecs,
                               DistanceMetric dm)
        Creates a new Random Ball Cover
        Parameters:
        vecs - the vectors to place into the RBC
        dm - the distance metric to use
      • RandomBallCover

        public RandomBallCover()
    • Method Detail

      • build

        public void build(boolean parallel,
                          java.util.List<V> collection,
                          DistanceMetric dm)
        Description copied from interface: VectorCollection
        Builds this metric index from the given collection of points using the given distance metric.
        Specified by:
        build in interface VectorCollection<V extends Vec>
        Parameters:
        parallel - true if the index should be built in parallel, or false if it should be done in a single thread.
        collection - the list of vectors to put into the index
        dm - the distance metric to build the index using.
      • search

        public void search(Vec query,
                           double range,
                           java.util.List<java.lang.Integer> neighbors,
                           java.util.List<java.lang.Double> distances)
        Description copied from interface: VectorCollection
        Performs a range search of the current collection. The index and distance of each found neighbor will be placed into the given Lists.
        Specified by:
        search in interface VectorCollection<V extends Vec>
        Parameters:
        query - the point to search for the neighbors within a given radius.
        range - the radius to search for all the neighbors with a distance ≤ range.
        neighbors - the list to store the index of the neighbors in. Will be sorted by distance to the query, and paired with the values in distances.
        distances - the list to store the distance of the neighbors to the query in. Will be sorted, and paired with the values in neighbors.
      • search

        public void search(Vec query,
                           int numNeighbors,
                           java.util.List<java.lang.Integer> neighbors,
                           java.util.List<java.lang.Double> distances)
        Description copied from interface: VectorCollection
        Performs k-Nearest Neighbor search of the current collection. The index and distance of each found neighbor will be placed into the given Lists.
        Specified by:
        search in interface VectorCollection<V extends Vec>
        Parameters:
        query - the point to search for the k-nearest neighbors of
        numNeighbors - the number of neighbors k to search for.
        neighbors - the list to store the index of the neighbors in. Will be sorted by distance to the query, and paired with the values in distances.
        distances - the list to store the distance of the neighbors to the query in. Will be sorted, and paired with the values in neighbors.
      • insert

        public void insert(V x)
        Description copied from interface: IncrementalCollection
        Incrementally adds the given datapoint into the collection
        Specified by:
        insert in interface IncrementalCollection<V extends Vec>
        Parameters:
        x - the vector to add to the collection
      • size

        public int size()
        Description copied from interface: VectorCollection
        Returns the number of vectors stored in the collection
        Specified by:
        size in interface VectorCollection<V extends Vec>
        Returns:
        the size of the collection
      • get

        public V get(int indx)
        Description copied from interface: VectorCollection
        Accesses a vector from this collection via index.
        Specified by:
        get in interface VectorCollection<V extends Vec>
        Parameters:
        indx - the index in [0, VectorCollection.size()) of the vector to access
        Returns:
        the vector from the collection

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.