Skip to content

k-nearest neighbors (KNN) classifier algorithm implementation in python.

Notifications You must be signed in to change notification settings

mx0c/knn-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

knn-python

A simple k-nearest neighbors (KNN) classifier algorithm implementation in python.

Usage

initialize knn instance

_knn = knn(k=8, distanceFunc=manhatten)

fit model with trainingsdata

_knn.fit(trainData,trainLabels)

predicts labels for a given list of samples

predictions = _knn.predict(samples)

test model with testdata

score = _knn.score(testData,testLabels)

Requirements

install requirements with: pip install -r requirements.txt

  • sklearn
  • numpy
  • matplotlib

About

k-nearest neighbors (KNN) classifier algorithm implementation in python.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages