Skip to content

Sondreespe/number-predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MNIST Neural Network From Scratch

A minimal project to understand the fundamentals behind neural networks.

This repository contains a small educational project where a neural network is built entirely from scratch using only NumPy.
The goal of the project is not to achieve state-of-the-art accuracy, but to understand:

  • How forward propagation works
  • How backward propagation (gradients) are computed
  • How weights and biases are updated through gradient descent
  • How a simple network can learn to recognize handwritten digits

This project is ideal for beginners who want to see how neural networks actually work under the hood — without relying on libraries such as TensorFlow or PyTorch.


What This Project Does

Implements a neural network from scratch

The model includes:

  • 784 input nodes (28×28 pixels)
  • 1 hidden layer (ReLU)
  • 10 output nodes (softmax)
  • Manual forward propagation
  • Manual backward propagation
  • Gradient descent training

No machine learning libraries are used — only NumPy.

Trains on the MNIST dataset

The mnist_to_csv.py script downloads MNIST using sklearn, normalizes it, and stores the images and labels inside data/train.csv and data/test.csv.

Allows you to inspect predictions

Inside the notebook you can:

  • Visualize digits
  • Compare predictions vs. labels
  • Inspect accuracy
  • Test random samples

Getting Started

Follow these steps to run the project on your own machine.

Install dependencies

pip install -r requirements.txt in the vscode terminal

Download the MNIST dataset (optional)

If you do not already have train.csv and test.csv, run:

python mnist_to_csv.py in the vscode terminal

This will download MNIST and save the dataset into the data/ folder.

Open the Jupyter Notebook

Inside the notebook you can:

  • Train the neural network
  • Visualize loss/accuracy
  • Test individual digits
  • Run predictions
  • Load or save model weights

About

Number prediction using a neural network and backpropagation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors