Skip to content

asafbigel/digit_classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

MNIST Digit Classification

This repository contains a Jupyter Notebook that implements and compares three ML approaches for the MNIST handwritten-digit dataset: the Perceptron Learning Algorithm (PLA), Softmax (logistic) Regression, and a Linear Regression baseline.

Project Structure

  • digit_mnist_classification.ipynb — main notebook with data loading, training, evaluation, and visualization.

Requirements

  • Python 3.8+ recommended
  • Packages used in the notebook:
    • numpy
    • scikit-learn
    • matplotlib
    • tqdm

Install the packages with pip:

python -m pip install --upgrade pip
python -m pip install numpy scikit-learn matplotlib tqdm

If you plan to run in Google Colab, most packages are preinstalled; you can still run the pip command in a Colab cell to ensure latest versions.

How to run

Local Jupyter (recommended):

# install requirements (see above)
python -m pip install numpy scikit-learn matplotlib tqdm
# start notebook server
jupyter notebook digit_mnist_classification.ipynb

Open the notebook and run cells sequentially. The notebook is annotated and divided into logical sections: data prep, PLA, Softmax, Linear Regression, and evaluation.

Google Colab:

Use the badge or open directly: Open in Colab

Configuration

Key top-level variables in the notebook that control training:

  • NUM_OF_ITERATION_PLA — iterations for the Perceptron training loop.
  • NUM_OF_ITERATION_SOFTMAX — iterations for Softmax gradient descent.

Change those variables near the top of the notebook to adjust trade-offs between runtime and accuracy. Note: higher iteration counts increase training time significantly.

Results & Evaluation

The notebook computes per-model accuracy, confusion matrices, and a summary table of accuracy vs. training time. See the Summary section inside the notebook for example historical results (different iteration counts tested).

Notes and Tips

  • The MNIST dataset is fetched with sklearn.datasets.fetch_openml — this requires internet on first run.
  • Training PLA in a one-vs-all setup can be slow for large iteration counts; consider reducing NUM_OF_ITERATION_PLA for quick experiments.

License

This repository currently has no formal license. If you intend to share or publish the code, consider adding a license (for example, MIT). If you want, I can add an LICENSE file with MIT text.


If you'd like, I can also add a minimal requirements.txt, an explicit LICENSE file, or insert the summary table from the notebook into this README. Tell me which of those you'd like next.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published