Package smile.neighbor
Class RandomProjectionForest
java.lang.Object
smile.neighbor.RandomProjectionForest
- All Implemented Interfaces:
KNNSearch<double[],
double[]>
A set of random projection trees.
-
Method Summary
Modifier and TypeMethodDescriptionstatic RandomProjectionForest
of
(double[][] data, int numTrees, int leafSize, boolean angular) Builds a random projection forest.Neighbor<double[],
double[]>[] search
(double[] q, int k) Retrieves the k nearest neighbors to the query key.toGraph
(int k) Returns a k-nearest neighbor graph.
-
Method Details
-
search
Description copied from interface:KNNSearch
Retrieves the k nearest neighbors to the query key. -
toGraph
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
-