A simple handwritten digit classifier in KNN coded with C++ using the MNIST dataset.
There is no optimization on the algorithm.
The dataset will be downloaded while building, so you just need:
- Build it with
make
- Now if there is no error, you will get a huge binary executable file (~55MB) with the dataset embedding in.
- Usage:
./knn K P
- Example:
./knn 10 3
, in which the '10' is the 'K' and the '3' is the power inminkowski_distance
.
Run the whole dataset while debugging is unnessary, so you can build it in debug mode:
- Build it with
make debug
- Debug Usage:
./debug K P TrainImageNum TestImageNum
- Example:
./debug 10 3 6000 2000
, in which '6000' is the number of images will be used from training dataset and '2000' is the number of images will be used from testing dataset.
WTFPL