Radius Neighbors Regressor#
This is the regressor version of Radius Neighbors implementing a binary spatial tree under the hood for fast radius queries. The prediction is a weighted average of each label from the training set that is within a fixed user-defined radius.
Note: Samples with 0 neighbors within radius will be predicted NaN.
Interfaces: Estimator, Learner, Persistable
Data Type Compatibility: Depends on distance kernel
Parameters#
# | Name | Default | Type | Description |
---|---|---|---|---|
1 | radius | 1.0 | float | The radius within which points are considered neighbors. |
2 | weighted | false | bool | Should we consider the distances of our nearest neighbors when making predictions? |
3 | tree | BallTree | Spatial | The spatial tree used to run range searches. |
Example#
use Rubix\ML\Regressors\RadiusNeighborsRegressor;
use Rubix\ML\Graph\Trees\BallTree;
use Rubix\ML\Kernels\Distance\Diagonal;
$estimator = new RadiusNeighborsRegressor(0.5, false, new BallTree(30, new Diagonal()));
Additional Methods#
Return the base spatial tree instance:
public tree() : Spatial
Last update:
2021-03-27