Skip to content

A fairly simple KNN digit classification algorithm tried out in multiple languages

Notifications You must be signed in to change notification settings

tavert/ClassifyDigits

 
 

Repository files navigation

Based on the "Digits Recognizer" Dojo here: https://github.com/c4fsharp/Dojo-Digits-Recognizer
 
Which in turn is based on the Kaggle challenge here:
http://www.kaggle.com/c/digit-recognizer

I've implemented this as a KNN classifier (where K=1) as a means 
of comparing multiple languages. 

Currently the implementations are in:

* F# (Parallel version)
* OCaml
  - classifyDigits.ml (non-parallelized version)
  - classifyDigitsPar.ml (uses Parmap to parallelize)

Also here:

* times.txt - uses 'time' to determine how long it takes to run 
  each version.

* trainingsample.csv - 5000 labeled training examples. A csv file with Label -> Pixel vector mappings. Pixel vector is an unrolled 28x28 grayscale (0-255) values (784 gray scale values).
* validationsample.csv - 500 labeled training examples. 


Each program reads in the training samples and then compares each of the 500 validation samples against those 5000 trainging samples and returns the label associated with the closest match (the vector with the shortest distance from a training example).

--------------------------------------------------------------
Notes: 
--------------------------------------------------------------

* F# example was built in monodevelop 4.0 with F# 3.0
* OCaml examples have build info at top of files.
* Examples run on a Dell XPS 13 i7 (Haswell) laptop with 8GB RAM.

About

A fairly simple KNN digit classification algorithm tried out in multiple languages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published