Skip to content

Sreenath67/neural-network-scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Neural Network from Scratch - Handwritten Digit Recognition

This project implements a fully connected neural network from scratch (using only NumPy) to recognize handwritten digits from the MNIST dataset.
No deep learning frameworks like TensorFlow or PyTorch are used — everything from forward propagation to backpropagation is coded manually.

A simple fully connected feedforward neural network with one hidden layer.

  • Manual coding of forward propagation, backpropagation, and gradient descent.
  • No use of high-level deep learning libraries—everything is written from scratch in NumPy
  • Achieved an accuracy of approximately 85%

Project Overview

  • Built a multi-layer neural network (with activation functions, loss function, and gradient descent).
  • Trained on the MNIST dataset (28x28 pixel handwritten digits).
  • Achieved good accuracy without using high-level ML libraries.
  • Visualized training performance and predictions.

How It Works

  1. Load and preprocess MNIST data ( train/test split).
  2. Define model architecture:
    • Input layer (784 nodes for 28×28 pixels)
    • Hidden layer (configurable, e.g., 128 neurons)
    • Output layer (10 neurons for digits 0–9)
  3. Initialize weights and biases randomly.
  4. Implement forward pass:
    • Hidden activations (ReLU)
    • Output layer (softmax)
  5. Implement backpropagation:
    • Compute gradients using chain rule
    • Use cross-entropy loss
  6. Train with gradient descent, updating weights over epochs, and print accuracy logs (e.g., every 10 iterations)

About

This project demonstrates a neural network built entirely from scratch using NumPy, without relying on high-level libraries such as TensorFlow or PyTorch. The network is trained on the MNIST handwritten digit dataset using only a single hidden layer with manual implementations of forward propagation, backpropagation and gradient descent.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors