Implementation of the algorithm Voted Perceptron and its variant Average on MNIST Dataset with 784 variables.
This algorithm classifies MNIST record doing a binary classification: number less of 5 and bigger or equale of 5.
URL | Title |
---|---|
Freund & Schapire(1999) | Large Margin Classification Using the Perceptron Algorithm |
MNIST_784 | The MNIST database of handwritten digits with 784 features |
To run this project, is necessary have Python 3.x environment
After cloning this repository, you need to install the basic dependencies to run the project on your system:
pip install -r requirements.txt
You can download MNIST Dataset clicking here.
You can run this program in the following ways, using shell parameters:
-
Draw Test Error Plot in function of epochs (Figure 2 of Freund & Schapire(1999) paper with
$d=1$ ):python3 main.py --drawTestErrorPlot --withAverageModel
-
Predict single record: predict the label of random record of Test Set. In this mode, script print on terminal the correct prediction, a plot of selected record and predicted label. Including
--withAverageModel
, it also predicts with average perceptron:python3 main.py --numberEpoch=100 --withAverageModel
dataSetFunctions.py
: functions to load, manipolate, split and read datasetparameters.py
: global variable to configure dataset splittingperceptronModel.py
: perceptron's class with train and predictionsdataset/
: folder with datasetdocs/
: folder with documentation and request
- Numpy - Fundamental package for math operations with arrays
- Matplotlib - Package to draw result and MNIST Record
- Argparse - Library to manage shell arguments
- Tqdm - Package to draw and manage progress bar