Skip to content

About

Basic ML model with GUI for recognizing digits

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

🧠 MNIST Neural Network from Scratch

A basic machine learning project implementing a fully connected neural network from scratch to classify handwritten digits from the MNIST dataset.

The model is trained using gradient based optimization and backpropagation, updating weights after processing each individual image.

This project also includes a simple GUI that allows users to draw digits and see real-time predictions from the trained model.


🚀 Features

Feature Example

  • Fully connected neural network implemented from scratch
  • Manual forward propagation and backpropagation
  • Gradient calculation per image (stochastic style updates)
  • Accuracy testing on 10.000 MNIST test images
  • Interactive GUI built with Pygame for live digit prediction

🧠 Model Architecture (Easily modifiable if wished)

  • Input Layer: 784 neurons (28x28 pixels)
  • Hidden Layers: 128 → 64 neurons
  • Output Layer: 10 neurons (digit classes 0–9)

📦 Requirements

Install dependencies:

pip install -r requirements.txt

Main libraries used:

  • numpy
  • pygame
  • python-mnist

▶️ How to Run

Run the GUI (draw and predict)

python3 main.py

This launches an interactive window where you can draw digits and see real time predictions by running an epoch on the training dataset.


Run accuracy test (10,000 test images)

python3 lib.py

This runs the trained model on the MNIST test set and prints the accuracy. After one training epoch the accuracy becomes approximately 96 %.


📊 Dataset

This project uses the MNIST handwritten digit dataset:

  • 60.000 training images
  • 10.000 test images
  • 28x28 grayscale images

🎯 Purpose

The goal of this project is to deeply understand:

  • How neural networks work internally
  • Backpropagation mechanics
  • Gradient-based learning
  • The relationship between model training and real time inference

This is an educational implementation focused on clarity and learning rather than using high level ML frameworks like TensorFlow or PyTorch.


About

Basic ML model with GUI for recognizing digits

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages