Skip to main content

sklearn-ann eases integration of approximate nearest neighbours libraries such as annoy, nmslib and faiss into your sklearn pipelines. It consists of:

  • Transformers conforming to the same interface as KNeighborsTransformer which can be used to transform feature matrices into sparse distance matrices for use by any estimator that can deal with sparse distance matrices. Many, but not all, of scikit-learn’s clustering and manifold learning algorithms can work with this kind of input.

  • RNN-DBSCAN: a variant of DBSCAN based on reverse nearest neighbours.

Installation

To install the latest release from PyPI, run:

pip install sklearn-ann

To install the latest development version from GitHub, run:

pip install git+https://github.com/scikit-learn-contrib/sklearn-ann.git#egg=sklearn-ann

Why? When do I want this?

The main scenarios in which this is needed is for performing clustering or manifold learning or high dimensional data. The reason is that currently the only neighbourhood algorithms which are build into scikit-learn are essentially the standard tree approaches to space partitioning: the ball tree and the K-D tree. These do not perform competitively in high dimensional spaces.

Development

This project is managed using Hatch and pre-commit. To get started, run pre-commit install and hatch env create. Run all commands using hatch run python <command> which will ensure the environment is kept up to date. pre-commit comes into play on every git commit after installation.

Consult pyproject.toml for which dependency groups and extras exist, and the Hatch help or user guide for more info on what they are.

Metadata

Release files for sklearn-ann 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sklearn-ann 0.2.0
File Size Uploaded Provenance Actions
sklearn_ann-0.2.0.tar.gz 24.1 kB With provenance Details for sklearn_ann-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sklearn-ann 0.2.0
File Interpreter ABI Platform Actions
sklearn_ann-0.2.0-py3-none-any.whl Python 3 none any Details for sklearn_ann-0.2.0-py3-none-any.whl

Total release size: 41.7 kB

Release files / sklearn_ann-0.2.0.tar.gz

Download URL sklearn_ann-0.2.0.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a6303e90acbfd44c155f85d38acf81bc19822f811fbc9c3852c36aeca48e0dcb
BLAKE2b-256 checksum
How to use checksums
213160b8295da4a167bfdbc9c0d94151794069a6511b502b424c8a80b0f97bff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / sklearn_ann-0.2.0-py3-none-any.whl

Download URL sklearn_ann-0.2.0-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37f19c8a9fc5ab57f77bdd0b629abded10d771082ee630bba1bb59e2b38b75c5
BLAKE2b-256 checksum
How to use checksums
2e755ac2851470520d34c46d050c957f72393996382330629efa93d3b3f0bd2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for sklearn-ann 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sklearn_ann-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page