100 beginner machine learning projects with runnable Python code, tests and honest case studies. By Networkers Home, Bangalore.
This teaching project implements a tiny feed-forward neural network from first principles using NumPy. The aim is to show how forward propagation, a loss function and backpropagation work in practice for a small classification task. The code trains a one-hidden-layer network on a built-in synthetic binary dataset and compares the network to a simple logistic regression baseline from scikit-learn. A small finite-difference gradient check is included to confirm the hand-derived gradients match numerical approximations.
The dataset is synthetic and generated with scikit-learn’s make_moons function (a classic two-dimensional binary classification toy). The data is small and deliberately simple so students can inspect weights, activations and losses. The dataset is split into a training set and a held-out test set using a fixed random seed.
Run the module directly: python project.py. The module prints a JSON object produced by run(seed=42).
The project includes pytest tests. Run pytest in the project directory. Tests check that the run() output has the expected keys, that metric ranges are sensible, that a conservative accuracy floor on the held-out set is met, and that repeated calls with the same seed are deterministic.
Measured by running python project.py (seed 42) on 2026-10-23; the tests in test_project.py assert the floor.
| Metric | Value |
|---|---|
| train_loss | 0.3185 |
| test_loss | 0.3034 |
| test_accuracy | 0.8333 |
| baseline_accuracy | 0.8333 |
| grad_check_diff | 0.0000 |
This is an educational implementation for understanding fundamentals. It is intentionally minimal: there is no batching beyond a simple SGD loop, no advanced optimisers, no regularisation tuning, and no GPU acceleration. The toy dataset is synthetic and small so the demonstration focuses on learning dynamics rather than production performance.
Possible extensions for students: add additional hidden layers, implement other activation functions, add L2 regularisation, implement mini-batch training and momentum, or visualise decision boundaries and loss curves (not included here to keep dependencies minimal).
Full case study, build steps and evaluation checks: Simple neural network from scratch on networkershome.com
Built by Networkers Home · Learn the skills in the AI Engineer Course · Part of 100 AI projects with code