Skip to content

nickleigh05/NNFS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Neural Networks From Scratch

A neural network built from scratch using only NumPy — no PyTorch, no TensorFlow, no autograd. Based on the Neural Networks from Scratch book by Harrison Kinsley, extended with an interactive Flask web GUI for live visualization.

What's in here

Core networkneuron_test.py

Full forward pass pipeline built by hand:

  • Dense (fully connected) layers
  • ReLU activation
  • Softmax activation with numerical stability (subtracts row max before exp to prevent overflow)
  • Categorical cross-entropy loss — handles both sparse integer labels and one-hot encoded labels

Interactive GUIneural_network_gui.py

Flask web app wrapping the network with 4 live visualizations:

  • Original spiral data
  • Network predictions vs ground truth
  • Per-class prediction confidence heatmap
  • Per-sample loss curve

Custom data generatorspiral_data.py

Hand-written n-class spiral dataset generator with configurable noise.

Setup

pip install numpy nnfs flask matplotlib

Usage

Run the core network:

python neuron_test.py

Launch the web GUI:

python neural_network_gui.py

Open http://localhost:5000, set the number of samples and classes, and hit Train.

Implementation breakdown

Component Details
Layer_Dense Weight init 0.01 * randn, bias init zeros, forward via dot product
Activation_ReLU Elementwise max(0, x)
Activation_Softmax Numerically stable — row-max subtraction before exp
Loss_CategoricalCrossentropy Clipped predictions, handles sparse and one-hot targets
Spiral generator Parameterized by points and classes, Gaussian noise on angle

Stack

Python · NumPy · Flask · Matplotlib

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages