Skip to content

Implemented K-Nearest Neighbors Algorithm for Digit Recognition (using the MNIST dataset)

Notifications You must be signed in to change notification settings

pmocal/k-nearest-neighbors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

k-nearest-neighbors

Background

For multiple groups of n points with a certain class c, I assigned the class whose points were closest on average to my point p.

Read here about the dataset.

Prerequisites

To run the code first you must have Python installed on your computer. If you are using Python 2 >=2.7.9 or Python 3 >=3.4 downloaded from python.org or if you are working in a Virtual Environment created by virtualenv or pyvenv then Pip is also installed.

After cloning this git directory,

$ pip install numpy

if you're using Python 2 or

$ pip3 install numpy

if you're using Python 3.

Running the code

knnvalidation.py prints out the errorcount and knntest.py labels the images in /digitsDataset.

Expect the programs to take a few minutes to complete.

Data is read from /digitsDataset and results are written to that directory.

About

Implemented K-Nearest Neighbors Algorithm for Digit Recognition (using the MNIST dataset)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages