Train your first machine learning model in 20 lines of Python
No maths degree required. Load data, split it, fit a model, check the score — the four steps every scikit-learn project uses, explained line by line.
From your first scikit-learn model to writing a transformer by hand. The fundamentals, the internals, and the evaluation mistakes that make good numbers meaningless.
Train a model, split your data properly, and understand what the numbers are telling you.
No maths degree required. Load data, split it, fit a model, check the score — the four steps every scikit-learn project uses, explained line by line.
A 99% accurate model that fails in production usually has data leakage. Learn the four ways test data sneaks into training and how a scikit-learn Pipeline prevents all of them.
Attention, transformers, convolutions and embeddings — worked out with real numbers instead of hand-waving.
The geometry of embedding space: why you normalise, what dimensionality really buys you, and the anisotropy problem nobody mentions.
Queries, keys and values with real numbers. Why the scaling factor is sqrt(d_k), what multi-head attention buys, and how causal masking works.
A working decoder-only transformer in 120 lines. Pre-norm, residual streams, why the MLP is 4x wide, weight tying, stable initialisation.
Measuring models honestly, finding the leaks that survive a correct split, and keeping them working after deployment.
Nine errors behind great offline metrics and bad production models: random splits on time series, threshold-free metrics, tuning on the test set.
Splitting correctly stops the obvious leak. Target encoding, feature stores, label windows and proxy features leak anyway — how to find each.
The model is the small part. Training-serving skew, feature freshness, shadow deploys, drift detection, and monitoring that catches decay.
Newsletter
Free essays on learning, Python, and ML — no account required. We’ll only email when there’s something worth reading.