Blog

Machine learning, explained from first principles.

Practical articles on learning ML properly: what to learn, in what order, and the mistakes that make good-looking models fail.

Machine learning

· 2 min read

Accuracy is lying to you: baselines, imbalance, precision and recall

Why a model that's right 89% of the time can be almost useless, and the three questions to ask before you trust any accuracy score.

· 2 min read

Data leakage in machine learning: how a model looks brilliant and fails on day one

What data leakage is, the five ways it sneaks in, and the habits that keep your validation scores honest.

· 9 min read

How to make an AI program that learns, step by step in Python

Build a small Python program that learns its own rule from examples, corrects its mistakes and beats a hand-written rule, then redo it in scikit-learn.

· 7 min read

Regression models in machine learning: 8 types compared in Python

The main regression models in machine learning, from linear and ridge to random forests and gradient boosting, compared on one dataset in Python.

· 3 min read

Cross-validation for groups and time: check what a split holds out

Audit random, grouped and chronological folds on the same small table, and choose a split that matches the prediction you intend to make.

· 3 min read

Logistic regression from scratch: fit probabilities and inspect errors

Implement stable binary cross entropy and its gradient in NumPy, train on invented data and compare held-out predictions with a constant baseline.

· 6 min read

Permutation feature importance: how it works and how to group correlated features

Permutation feature importance is how far a model's score drops when one feature is shuffled. Python code, a comparison with MDI and grouped shuffles.

· 5 min read

Linear regression in machine learning: a worked Python example with a baseline

Learn linear regression with a worked prediction, runnable Python, a held-out test and a baseline. Explain coefficients and check where a line can fail.

· 5 min read

Machine learning for business analytics: start with the decision, then the model

Plan a useful machine learning project for business analytics: define a decision, compare a rule, choose data and evaluate errors with a worked example.

· 5 min read

Machine learning for predictive analytics: define the target, beat a baseline, test fairly

Build a predictive analytics experiment with a demand example: define the target, use prediction-time inputs, beat a baseline and test on held-out data.

· 5 min read

Machine learning for unlabeled data: a clustering example and how to check it

Explore unlabeled data with a runnable clustering example. Understand cluster IDs, scaling, useful checks and when you still need human labels.

· 8 min read

Machine learning interview questions: how to prepare, with worked answers

Machine learning interview questions with worked answers: splits, leakage, precision and recall, baselines, gradient descent and regularisation, in Python.

· 5 min read

Overfitting vs underfitting: examples and how to fix each

Tell overfitting from underfitting with training and validation error, work through a demand example and choose a sensible next experiment.

· 9 min read

Where to start with machine learning: a four-step path for beginners

Start machine learning with Python, then NumPy and pandas, the maths a model uses, and linear regression. A four-step path for beginners, with checkpoints.

· 11 min read

How to learn AI from scratch: a 12-week plan for beginners

Learn AI from scratch in order: Python, data tools, maths, statistics, a first model, then an AI app. A 12-week plan with checkpoints and free resources.

· 9 min read

Machine learning engineer roadmap: seven stages, each with a checkpoint

A machine learning engineer roadmap in seven stages, from Python as software to a portfolio. Each stage lists what to study and ends in a checkpoint.

· 6 min read

How to get an AI or machine learning internship: what to learn, build and explain

Get an AI or machine learning internship: the four skills interviewers test, two projects worth building, where to find openings and how to apply.

· 6 min read

AI engineer vs machine learning engineer: the difference, and what to learn for each

An ML engineer trains and deploys models; an AI engineer builds products on models like LLMs. Compare the work, skills and maths, and what to learn.

First Principles, the SchoolWhool newsletter

One machine learning idea, explained properly, every week.

The intuition, the common mistake, and a five-minute way to try it yourself. Written by Gaurav.