Source

Radius Neighbors#

Radius Neighbors is a spatial tree-based classifier that takes the weighted vote of each neighbor within a fixed user-defined radius measured by a kernelized distance function. Since the radius of the search can be constrained, Radius Neighbors is more robust to outliers than K Nearest Neighbors.

Note: Unknown samples with no training samples within radius are labeled -1. As such, Radius Neighbors is also a quasi anomaly detector.

Interfaces: Estimator, Learner, Probabilistic, Persistable

Data Type Compatibility: Continuous

Parameters#

# Param Default Type Description
1 radius 1.0 float The radius within which points are considered neighboors.
2 weighted true bool Should we use the inverse distances as confidence scores when making predictions?
3 tree BallTree object The spatial tree used to run range searches.

Additional Methods#

Return the base spatial tree instance:

public tree() : Spatial

Example#

use Rubix\ML\Classifiers\RadiusNeighbors;
use Rubix\ML\Graph\Trees\KDTree;
use Rubix\ML\Kernels\Distance\Manhattan;

$estimator = new RadiusNeighbors(50.0, false, new KDTree(100, new Manhattan()));