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.1.tar.gz
(2.2 kB
view details)
Built Distribution
File details
Details for the file py4knn-0.0.1.tar.gz
.
File metadata
- Download URL: py4knn-0.0.1.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 | 4f6c8956bdee5048b9d60381c9df01db23539389cada8dfdb5054d53126f99b6 |
|
MD5 | 2fc040f58323358f179b0146e84cf33a |
|
BLAKE2b-256 | 119d9549cfb7e8ff74b837b69b9b7a4746ec58f5db884d4adbd1e228ea408bb1 |
File details
Details for the file py4knn-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: py4knn-0.0.1-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 | 70003b64acd274c6850c5e7c95a798366c02e09a750970038d118a89e409695a |
|
MD5 | 07b82ca36535ee8a7408f78d939b0491 |
|
BLAKE2b-256 | 2fe0f1bb5f8858454390ebd5935079cb122342dd7f36dc2ac609c2b4f05ec68e |