Skip to main content

simple-kNN

PyPI CI

This repository is for Continuous Integration of my simple k-Nearest Neighbors (kNN) algorithm to pypi package.

For notebook version, please visit this repository

k-Nearest Neighbors

k-Nearest Neighbors, kNN for short, is a very simple but powerful technique used for making predictions. The principle behind kNN is to use “most similar historical examples to the new data.”

k-Nearest Neighbors in 4 easy steps

  • Choose a value for k
  • Find the distance of the new point to each record of training data
  • Get the k-Nearest Neighbors
  • Making Predictions
    • For a classification problem, the new data point belongs to the class that most of the neighbors belong to.
    • For a regression problem, the prediction can be an average or weighted average of the labels of k-Nearest Neighbors

Finally, we evaluate the model using the k-Fold Cross Validation technique

k-Fold Cross Validation

This technique involves randomly dividing the dataset into k approximately equal-sized groups, or folds. The first fold is kept for testing, and the model is trained on the remaining k-1 folds.

Installation

pip install simple-kNN

Usage

from simple_kNN.distanceMetrics import distanceMetrics
from simple_kNN.kFoldCV import kFoldCV
from simple_kNN.kNNClassifier import kNNClassifier

References

Coming soon

  • Other variants of the kNN algorithm
  • Recommendations using the kNN algorithm

Metadata

Release files for simple-kNN 2.0.1

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

Source distribution (sdist)

Source distribution for simple-kNN 2.0.1
File Size Uploaded Provenance Actions
simple_knn-2.0.1.tar.gz 143.1 kB Without provenance Details for simple_knn-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for simple-kNN 2.0.1
File Interpreter ABI Platform Actions
simple_knn-2.0.1-py3-none-any.whl Python 3 none any Details for simple_knn-2.0.1-py3-none-any.whl

Total release size: 284.1 kB

Release files / simple_knn-2.0.1.tar.gz

Download URL simple_knn-2.0.1.tar.gz
Size 143.1 kB
Tags Source
SHA-256 checksum
How to use checksums
223a0cc39f638e84787c7d2407aaec5e4c0a5ff80811608839575454f8f6c861
BLAKE2b-256 checksum
How to use checksums
60c579c096a7409aad8519c82483b62ed33c1c8d1ca80cf259d670407fab8303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / simple_knn-2.0.1-py3-none-any.whl

Download URL simple_knn-2.0.1-py3-none-any.whl
Size 141.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ef5b0f79a4c72faf13f4f2dc7ec4021b5fc8876fd1ea98c36fdab41781eada6
BLAKE2b-256 checksum
How to use checksums
22033abfa783515d296cbd4ac24213e8af2fdfa5a7611e5ddba97ec37c16574e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for simple-kNN 2.0.1

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.

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