Skip to main content

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 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.4.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

py4knn-0.0.4-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file py4knn-0.0.4.tar.gz.

File metadata

  • Download URL: py4knn-0.0.4.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

Hashes for py4knn-0.0.4.tar.gz
Algorithm Hash digest
SHA256 a3a390e441cb1fe7fb0e2877f71c0427fc59dccfb6506f4f689a88eb7b9e5aa3
MD5 40e55b5fc484b50af107c9d44c85b0fe
BLAKE2b-256 b8bbbe5d09ddab116a51167767c28a439904a0b2344915eb006848aa53248c6b

See more details on using hashes here.

File details

Details for the file py4knn-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: py4knn-0.0.4-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

Hashes for py4knn-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 758ee9d8e8e777e596a066f47622f50fa90983a309308d7ecf2f2b14d626af27
MD5 61e6c180fd129d4cefb2d18b6372ce13
BLAKE2b-256 981e9d826c24a9e1c81f52162623fb22836d61f5d303715cee4dcbf08176cf13

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page