🤖

Machine Learning from Scratch

Learn machine learning by building it — gradient descent, logistic regression, decision trees, and k-means implemented by hand and run in your browser, then the professional scikit-learn stack used correctly.

📚 54 lessons 🧩 10 phases ▶ Runs real Python code
Start learning →

A machine learning course that teaches the durable skill, not the button. Because an AI can already write model.fit() for you, this course has you implement the algorithms from scratch — the gradient-descent update rule, the sigmoid, entropy and information gain, k-means — in real Python that runs live in your browser. You will build the evaluation tools that catch the expensive mistakes, reproduce the traps that make a broken model look brilliant, and only then meet scikit-learn, used correctly and verified at build time.

Module 1 · Why Machine Learning Still Needs You

What machine learning is, when it is the right tool, and — the question that separates engineers from button-pushers — when it is the wrong one. The honest foundation the rest of the course builds on.

  1. What Machine Learning Actually Is 19 min
  2. When ML Is the Wrong Tool 19 min
  3. Machine Learning in the Age of Large Models 19 min
  4. The Three Kinds of Learning 18 min
  5. The Real ML Workflow 18 min

Module 2 · Data Before Models

Models are only as honest as the data underneath them. Build the tools to describe, split, and scale data by hand — and meet your first data-leakage trap, the bug that fakes a great model.

  1. Describing a Dataset from Scratch 18 min
  2. Features, Labels, and the Design Matrix 18 min
  3. The Train/Test Split, Implemented 18 min
  4. Feature Scaling and Why It Matters 19 min
  5. Your First Data-Leakage Trap 19 min

Module 3 · Regression from Scratch

Predict a number, and learn the engine that powers most of ML while you do it: gradient descent. You will implement the update rule, watch the loss fall, and feel where it breaks.

  1. The Idea of a Line of Best Fit 17 min
  2. Measuring Wrongness: Mean Squared Error 17 min
  3. Gradient Descent, Built by Hand 18 min
  4. The Learning Rate: Too Big, Too Small, Just Right 17 min
  5. Regression with Multiple Features 19 min
  6. Underfitting and the Limits of a Line 19 min

Module 4 · Classification from Scratch

Predict a category. Build logistic regression from the sigmoid up, draw a decision boundary, and understand probabilities you can actually trust — or not.

  1. Classification vs Regression 18 min
  2. The Sigmoid Function, Implemented 18 min
  3. Logistic Regression from Scratch 18 min
  4. Decision Boundaries 16 min
  5. From Two Classes to Many 16 min

Module 5 · Evaluation & the Accuracy Trap

The most expensive mistakes in ML are evaluation mistakes. Build the confusion matrix, precision, recall, ROC and PR curves, and calibration — and see why 99% accuracy can mean a useless model.

  1. Why Accuracy Lies 18 min
  2. The Confusion Matrix 18 min
  3. Precision, Recall, and F1 18 min
  4. ROC and Precision-Recall Curves 17 min
  5. Calibration: Are the Probabilities Real? 17 min
  6. Choosing a Threshold Under Asymmetric Cost 17 min

Module 6 · Trees & Ensembles from Scratch

Decision trees are how ML reasons in if-then steps — and ensembles are how a crowd of weak trees becomes a strong model. Build the split criterion, the tree, and the intuition for bagging vs boosting.

  1. How a Decision Tree Thinks 16 min
  2. Entropy and Information Gain 17 min
  3. Build a Decision Tree 19 min
  4. Why a Deep Tree Memorises 18 min
  5. Bagging vs Boosting 18 min

Module 7 · Unsupervised Learning

No labels, only structure. Build k-means, confront the ways clusters mislead, and reduce dimensions — the tools for when nobody told you the right answer.

  1. Finding Structure Without Labels 18 min
  2. K-Means, Built by Hand 19 min
  3. Choosing the Number of Clusters 19 min
  4. When Clusters Lie 18 min
  5. The Idea of Dimensionality Reduction 18 min

Module 8 · Overfitting & Honest Validation

The central tension of ML: a model that fits the past too well fails the future. Build regularisation and cross-validation, and the leakage-proof validation that most tutorials get wrong.

  1. The Bias–Variance Tradeoff 19 min
  2. Regularisation: Penalising Complexity 19 min
  3. K-Fold Cross-Validation 19 min
  4. Nested Cross-Validation and the Tuning Leak 18 min
  5. Group and Time-Series Splits 17 min

Module 9 · How You Get Deceived

The module the market asks for by name: the traps that make a broken model look brilliant. Leakage, drift, spurious correlation, Simpson's paradox, and imbalance — each reproduced and each defended against.

  1. Target Leakage: The Feature That Knows the Answer 19 min
  2. Data Drift: When the World Moves On 18 min
  3. Spurious Correlation and Confounders 18 min
  4. Simpson's Paradox: When the Trend Reverses 18 min
  5. Imbalance and the Sampling Traps 18 min
  6. Spending Compute on the Wrong Thing 18 min

Module 10 · The Professional Stack & Capstone

Now that you have built the ideas by hand, meet the tools professionals actually use — scikit-learn, pipelines — used correctly, verified at build time. Then decide, for a real problem, between classical ML, fine-tuning, and prompting, and ship a capstone.

  1. Meet scikit-learn (You Already Know What It Does) 18 min
  2. Pipelines: Leakage-Proof by Construction 18 min
  3. Model Selection and Hyperparameter Search 18 min
  4. Classical ML vs Fine-Tuning vs Prompting 16 min
  5. Deployment and Monitoring Judgment 16 min
  6. Capstone: An Honest End-to-End Model 20 min