sklearn.neighbors#

The k-nearest neighbors algorithms.

User guide. See the Nearest Neighbors section for further details.

BallTree

BallTree for fast generalized N-point problems

KDTree

KDTree for fast generalized N-point problems

KNeighborsClassifier

Classifier implementing the k-nearest neighbors vote.

KNeighborsRegressor

Regression based on k-nearest neighbors.

KNeighborsTransformer

Transform X into a (weighted) graph of k nearest neighbors.

KernelDensity

Kernel Density Estimation.

LocalOutlierFactor

Unsupervised Outlier Detection using the Local Outlier Factor (LOF).

NearestCentroid

Nearest centroid classifier.

NearestNeighbors

Unsupervised learner for implementing neighbor searches.

NeighborhoodComponentsAnalysis

Neighborhood Components Analysis.

RadiusNeighborsClassifier

Classifier implementing a vote among neighbors within a given radius.

RadiusNeighborsRegressor

Regression based on neighbors within a fixed radius.

RadiusNeighborsTransformer

Transform X into a (weighted) graph of neighbors nearer than a radius.

kneighbors_graph

Compute the (weighted) graph of k-Neighbors for points in X.

radius_neighbors_graph

Compute the (weighted) graph of Neighbors for points in X.

sort_graph_by_row_values

Sort a sparse graph such that each row is stored with increasing values.