Neural Network Study
An implementation of a toy neural network from scratch. The idea is to learn about the workings of neural networks and the underlying math, but also to produce something useful and, most of all, fun.
This project follows a series on neural networks on The Coding Train.
What does it do?
Stage 1: Perceptron
The first step is creating a perceptron, a single "neuron" that can be used to solve linearly separable problems. An example is classifying points on a plane to determine if they're above or below a line.
Stage 2: Multilayer Perceptron - The Neural Network
Once the principle of the perceptron is understood, the next major step in developing a neural network is to create a multilayer perceptron, with inputs, hidden layers, and outputs. This library supports any number of hidden layers, including none for a perceptron.
This evolution of the concept can solve a variety of problems. A classic example is a game of moving a basket to catch falling apples -- and in this enhanced version, avoid the sour lemons.
Demos
Decision Boundary Playground
A small binary generates a self-contained HTML playground that trains the network on a few 2D classification tasks and visualizes the learned decision boundary.
Run it with:
Then open target/decision-boundary-playground.html in a browser.
Flappy Evolution Playground
A binary trains a population of neural networks to play a Flappy Bird-like game with genetic evolution, then generates a standalone replay/report HTML file and saves the best model.
Run it with:
Artifacts:
target/flappy-evolution-playground.html(interactive generation replay + metrics)target/flappy-champion.json(best model checkpoint)
To warm-start a run from an existing model:
Depth Benchmark Playground
A binary compares shallow and deep architectures on nonlinear 2D datasets (including two spirals), then produces an interactive report with side-by-side decision boundaries and loss curves.
This is an exploratory comparison: deeper networks have more parameters, and each architecture uses a single random seed. Training uses squared error with tanh targets of -1 and 1; the report maps outputs to probabilities and shows binary cross-entropy as an evaluation metric.
Run it with:
Artifact:
target/depth-benchmark.html(interactive depth comparison report)