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
simple_knn-2.0.1.tar.gz 143.1 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.0

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

0.5

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

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