K-Nearest Neighbors Python Library
Project description
py4knn
K-Nearest Neighbors Python Library
Getting Started
This project is simply implementation of K-Nearest Neighbors algorithm in python programming language.
Prerequisites
This Project Has No Prerequisites
Installing
The easiest way to install py4knn is using pip
pip install py4knn
Usage
There is only 1 method public method of knn class. It is predict method, it takes 5 argument namely x_train, t_train, x_test, k, and distance calculation method. We provide 6 distance namely euclidean, squared_euclidean, manhattan, canberra, chebyshev, and bray_curtis.
from py4knn.k_nearest_neighbors import knn
classifier = knn()
x_train=[[0.23,0.54],[0.45,1.23],[1.54,0.23],[0.93,0.535]]
t_train=[0,1,0,1]
x_test=[[0.34,0.65],[0.90,0.50]]
y=classifier.predict(x_train,t_train,x_test,1,'eclidean')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py4knn-0.0.2.tar.gz
(2.2 kB
view details)
Built Distribution
File details
Details for the file py4knn-0.0.2.tar.gz
.
File metadata
- Download URL: py4knn-0.0.2.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21f1d00cfeed82d35c080c10b7ebf0362d7b30120b5fa577bb6e36587566d100 |
|
MD5 | 24cb92554561abc6449736392a168a48 |
|
BLAKE2b-256 | 700973abb1a9d61749a1b181db05e98152dc3aaf3e9a455b539fbec22df3cc49 |
File details
Details for the file py4knn-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: py4knn-0.0.2-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ded1398e1f6847e0fec247b101b2acefed7b8aecac8162fadb238038dd81041 |
|
MD5 | 2499c9e80b814c7fd1f5f016f31c72f2 |
|
BLAKE2b-256 | bbac561eb85a93d82df5737f48e7bf94801594fc09d330aed5894cc5dafed9f9 |