Multilayer perceptron
Classifies breast tumours as benign or malignant with a neural network written in NumPy: layers, losses and optimisers behind a Keras-like API.
TL;DR
- 97.4 % val. accuracy
- 569 samples
My partA Keras-like API: a CustomSequential model stacking Dense layers.
- ROLE
- Solo
- CONTEXT
- École 42 · AI projects
- STATUS
- Done
- RESULT
- 96.5–97.4 % validation accuracy across three 80/20 runs (seed 42); the main run with early stopping on validation loss reached 96.5 %.
- LAST UPDATED
- 26 Sep 2026
1
Data
Wisconsin Breast Cancer (Diagnostic), UCI: 569 tumours described by measurements of cell nuclei, labelled benign or malignant.
2
What I built
Solo
- A Keras-like API: a CustomSequential model stacking Dense layers.
- Forward pass and backpropagation, with binary cross-entropy, categorical cross-entropy and MSE losses.
- SGD and Adam optimisers, and early stopping on validation loss.
- A Colab notebook that trains and evaluates the model end to end.
3
Key choices
- Mirror the Keras API
- I followed the structure of the official Keras documentation, with layers, losses and optimisers as separate classes behind one model object. It kept the code modular instead of a growing pile of functions.
4
Results
96.5–97.4 % validation accuracy across three 80/20 runs (seed 42); the main run with early stopping on validation loss reached 96.5 %.
5
Limits
- The validation split also drives early stopping, and there is no separate test set, so these scores are optimistic.
- The logs show overfitting: training accuracy reaches 1.0 and training loss falls to ~0 while validation loss climbs to 0.66–0.73 by epoch 50.
- One split of 569 samples: a different seed could move the score by a few points. Cross-validation would give a range.
Questions about this project? → Email me