Multilayer perceptron
Benign vs malignant tumour classifier. Layers, losses and optimisers written in NumPy behind a Keras-like API.
- ROLE
- Solo · École 42 · AI projects
- STACK
- Python · NumPy · pandas
- RESULT
- 97.4 % validation accuracy on one 80/20 split, also used for early stopping.
- LINKS
- Code ↗Notebook ↗
- READING TIME
- 1 min read
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
97.4 % validation accuracy on one 80/20 split, also used for early stopping.
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 while validation loss rises from 0.20 to 0.73.
- 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