A fast k nearest neighbors algorithm that uses a binary tree to divide the training set into neighborhoods. K-d Neighbors then does a binary search to locate the nearest neighborhood of an unknown sample and prunes all neighborhoods whose bounding box is further than the kth nearest neighbor found so far. The main advantage of K-d Neighbors over brute force KNN is that it is more efficient, however it cannot be partially trained.
Data Type Compatibility: Continuous
|1||k||5||int||The number of nearest neighbors to consider when making a prediction.|
|2||weighted||true||bool||Should we use the inverse distances as confidence scores when making predictions?|
|3||tree||KDTree||object||The spatial tree used to run nearest neighbor searches.|
Return the base spatial tree instance:
public tree() : Spatial
use Rubix\ML\Classifiers\KDNeighbors; use Rubix\ML\Graph\Trees\BallTree; use Rubix\ML\Kernels\Distance\Minskowski; $estimator = new KDNeighbors(3, false, new BallTree(40, new Minkowski()));