Metadata-Version: 2.4
Name: simple_kNN
Version: 2.0.1
Summary: Simple kNN algorithm with k-Fold Cross Validation
Home-page: https://github.com/chaitanyakasaraneni/simple-kNN
Author: Chaitanya Krishna Kasaraneni
Author-email: kc.kasaraneni@gmail.com
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Intended Audience :: Science/Research
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# simple-kNN

[![PyPI](https://img.shields.io/pypi/v/simple-kNN?color=green&label=PyPI&style=for-the-badge)](https://pypi.org/project/simple-kNN/)
[![CI](https://img.shields.io/github/actions/workflow/status/chaitanyakasaraneni/simple-kNN/publish.yml?branch=main&label=Continuous%20Integration&logo=GitHub&style=for-the-badge)](https://github.com/chaitanyakasaraneni/simple-kNN/actions/workflows/publish.yml)

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

For notebook version, please visit [this repository](https://github.com/chaitanyakasaraneni/knnFromScratch)

#### *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
- My [medium article on building kNN from scratch](https://link.medium.com/BV27Pox3qab)
- More info on Cross Validation can be seen [here](https://medium.com/datadriveninvestor/k-fold-and-other-cross-validation-techniques-6c03a2563f1e)
- [kNN](https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html)
- [kFold Cross Validation](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.KFold.html)

#### Coming soon
- Other variants of the kNN algorithm
- Recommendations using the kNN algorithm
