Class RandomProjectionForest

java.lang.Object
smile.neighbor.RandomProjectionForest
All Implemented Interfaces:
KNNSearch<double[],double[]>

public class RandomProjectionForest extends Object implements KNNSearch<double[],double[]>
A set of random projection trees.
  • Method Details

    • search

      public Neighbor<double[],double[]>[] search(double[] q, int k)
      Description copied from interface: KNNSearch
      Retrieves the k nearest neighbors to the query key.
      Specified by:
      search in interface KNNSearch<double[],double[]>
      Parameters:
      q - the query key.
      k - the number of nearest neighbors to search for.
      Returns:
      the k nearest neighbors
    • toGraph

      public NearestNeighborGraph toGraph(int k)
      Returns a k-nearest neighbor graph.
      Parameters:
      k - k-nearest neighbors.
      Returns:
      k-nearest neighbor graph.
    • of

      public static RandomProjectionForest of(double[][] data, int numTrees, int leafSize, boolean angular)
      Builds a random projection forest.
      Parameters:
      data - the data set.
      numTrees - the number of trees.
      leafSize - The maximum size of leaf node.
      angular - true for angular metric, otherwise Euclidean.
      Returns:
      random projection forest