solow-neighbors covers the full nearest-neighbor stack: data structures, k-NN and radius-neighbor predictors, nearest centroid, local outlier factor, and multivariate kernel density estimation.
Type What it does
KdTreeBalanced KD-tree with bounding-box pruning. Expected O(k log n) queries in low dimensions.
BallTreeBall-tree partition for moderate-dimensional data where KD-tree pruning weakens.
Estimator What it does
KNeighborsClassifierk-NN classification with uniform or distance-weighted votes.
KNeighborsRegressork-NN regression with uniform or distance-weighted averaging.
RadiusNeighborsClassifierFixed-radius neighborhood classification.
RadiusNeighborsRegressorFixed-radius neighborhood regression.
NearestCentroidRocchio-style classifier that assigns each query to the nearest class-mean centroid.
Estimator What it does
LocalOutlierFactorBreunig-Kriegel (2000) density-based outlier scoring.
KernelDensityMultivariate KDE with Gaussian, tophat, Epanechnikov, exponential, linear, cosine kernels.
#![allow(unused)]
fn main() {
use solow_neighbors::{KNeighborsClassifier, WeightKind};
let knn = KNeighborsClassifier::new(5)
.weights(WeightKind::Distance)
.fit(&x, &y)?;
let proba = knn.predict_proba(&x_test)?;
Ok::<_, solow_core::Error>(())
}