Nearest neighbors — scikit-hubness 0.21.0 documentation

# Nearest neighbors

The `skhubness.neighbors` subpackage provides several neighbors-based learning methods. It is designed as a drop-in replacement for scikit-learn’s `neighbors`. The package provides all functionality from `sklearn.neighbors`, and adds support for transparent hubness reduction, where applicable, including

- classification (e.g. `KNeighborsClassifier`),

- regression (e.g. `RadiusNeighborsRegressor`),

- unsupervised learning (e.g. `NearestNeighbors`),

- outlier detection (`LocalOutlierFactor`), and

- kNN graphs (`kneighbors_graph`).

In addition, scikit-hubness provides approximate nearest neighbor (ANN) search, in order to support large data sets with millions of data objects and more. A list of currently provided ANN methods is available here.

Hubness reduction and ANN search can be used independently or in conjunction, the latter yielding approximate hubness reduction. User of scikit-learn will find that only minor modification of their code is required to enable one or both of the above. We describe how to do so here.

For general information and details about nearest neighbors, we refer to the excellent scikit-learn User Guide on Nearest Neighbors.