Skip to main content

K-Nearest Neighbors Python Library

Project description

py4knn

K-Nearest Neighbors Python Library

Getting Started

This project is simply an implementation of K-Nearest Neighbors algorithm in python programming language.

Prerequisites

This Project Has No Prerequisites

Installing

The easiest way to install py4knn is by 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 distances 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,'euclidean')

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: py4knn-0.0.5.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for py4knn-0.0.5.tar.gz
Algorithm Hash digest
SHA256 91c1cf5d9c016d85357a8522d032f012bbba52d89e6831caa85fcc8c3be516d5
MD5 9d91e89dd994a2fa23e61a77871c34b9
BLAKE2b-256 d31f92ef9b4d0aa8ff057e3aac14358292abdee0cfe70dea75e3ded1470d002b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py4knn-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for py4knn-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 173539824784c97dbf46aa7e90cf800c2c7001d2a59e28b5715518b60f370160
MD5 17d63aca8b805e41b885d111c91d73df
BLAKE2b-256 35527a5399069c1341ba0f964f177d6099ceee5e3c50c2569be7633dc4e82f09

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