Skip to content

NoMoreCookies/Neural-Network-from-Scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Network from Scratch (NumPy)

A minimal, fully-connected feedforward neural network implemented from scratch in Python using NumPy. Supports mini-batch SGD training with backpropagation and sigmoid activations.

Inspired by Michael Nielsen’s Neural Networks and Deep Learning.

Why this project?

I built this to understand the full training pipeline end-to-end: forward pass → cost gradient → backpropagation → parameter updates (weights & biases), without relying on high-level frameworks.

Features

  • Flexible architecture via sizes (e.g. [784, 64, 10])
  • Sigmoid activation function
  • Mini-batch Stochastic Gradient Descent
  • Backpropagation for gradients of weights and biases
  • Simple evaluation with score() (classification accuracy count)

Tech stack

  • Python
  • NumPy

Project structure

├── network.py # Network class + sigmoid utilities 
├── train.py # Example training script (you create this) 
├── data_loader.py # Optional: load/prepare dataset (you create this)
└── README.md

Installation

python -m venv .venv
# Windows:
.venv\Scripts\activate
# Linux/macOS:
source .venv/bin/activate

pip install -r requirements.txt

Running

python test.py

Results

Test accuracy: ~95% on the MNIST test set (10,000 images).
Model: sizes = [784, 30, 10] (sigmoid activations).
Training: epochs = 10, mini-batch size = 10, eta (learning rate) = 1.0.
Preprocessing: input pixels normalized to [0, 1], labels one-hot encoded for training

Building-from-scratch

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages