SmartKNN
A modern, weighted nearest-neighbor learning algorithm with learned feature importance and adaptive neighbor search.
Overview
SmartKNN is a nearest-neighbor–based learning method that belongs to the broader KNN family of algorithms.
It is designed to address common limitations observed in classical KNN approaches, including:
- uniform treatment of all features
- sensitivity to noisy or weakly informative dimensions
- limited scalability as dataset size grows
SmartKNN incorporates data-driven feature importance estimation, dimension suppression, and adaptive neighbor search strategies. Depending on dataset characteristics, it can operate using either a brute-force search or an approximate nearest-neighbor (ANN) backend, while exposing a consistent, scikit-learn–compatible API.
The method supports both regression and classification tasks and prioritizes robustness, predictive accuracy, and practical inference latency across a range of dataset sizes.
Key Capabilities
- Learned feature weighting
- MSE relevance
- Mutual Information
- Random Forest importance
(method configurable depending on task and dataset)
- Automatic preprocessing
- normalization
- NaN / Inf handling
- feature masking
- Distance-weighted neighbor voting
- Brute-force and ANN backends
- designed to scale to large datasets (hardware and tuning dependent)
- optional GPU-accelerated neighbor search
- Vectorized NumPy with Numba acceleration
- Scikit-learn–compatible API
Installation
pip install smart-knn
Documentation
Detailed documentation and design notes are maintained externally. This repository README is intentionally kept concise.
Examples
Runnable examples are available in the examples/ directory:
python examples/regression_example.py
python examples/classification_example.py
Benchmarks & CI
- Comprehensive benchmark suites for regression and classification
- GitHub Actions CI for tests and benchmarks
- Reproducible, engineering-focused evaluation
Benchmark details are documented in benchmarks/README.md.
Project Status
- SmartKNN v2 is stable
- API is frozen for the v2.x series (backward-compatible improvements only)
- Actively maintained
- Open to research and engineering collaboration
License
SmartKNN is released under the MIT License. See LICENSE for details.
Metadata
Release files for smart-knn 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smart_knn-0.2.3.tar.gz | 19.8 kB | Without provenance | Details for smart_knn-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| smart_knn-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for smart_knn-0.2.3-py3-none-any.whl |
Total release size: 38.4 kB
Release files / smart_knn-0.2.3.tar.gz
| Download URL | smart_knn-0.2.3.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0bcd7de88f95c46fd542f067bf45d3bc3f20dc6b69435e987bd8edaaf69a43b
|
|
BLAKE2b-256 checksum How to use checksums |
8739b5d24c6943d47da204f0d4646f3c8de0d09e7f71ea7ca05d2fabf0c6f25e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Release files / smart_knn-0.2.3-py3-none-any.whl
| Download URL | smart_knn-0.2.3-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9e505298b24b387ba4a3b4b327fa8579b44eb981cb425275965f5bb18c0a5c2
|
|
BLAKE2b-256 checksum How to use checksums |
56c0fd8940fe9ddc26e6ea0f97dd935bbe9b2039d5684996d29c81e38205d601
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Security for smart-knn 0.2.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.