Course 5 of 7 · Beginner

Machine Learningfrom first model to production.

Each algorithm is taken from the problem to working code: the data, a baseline, the model, how it learns, how it fails, and how to measure it.

18modules
91lessons planned
51ready to study now
3free videos

Who Machine Learning is for and what you will learn

This track is for you if

  • You want to build models and know whether they actually work.
  • You have used scikit-learn without knowing why the algorithms behave as they do.
  • You are preparing to explain models in machine learning interviews.

By the end you can

  • Build regression and classification models from scratch.
  • Understand the calculus and optimisation behind how models learn.
  • Evaluate models properly and spot overfitting.
  • Use trees, ensembles and clustering on real data.
  • Take a model from a notebook to production.

Before you start

Basic Python. The maths and statistics each lesson needs are linked from it, and each lesson stands on its own.

Every open lesson is free to read. The opening modules are a free sample: a free account opens all of their material. Pro adds it for the rest of the course.

The syllabus18 modules, each ending in its own finish line.

Every lesson is listed, including the ones still in production, so you can see where the track goes. Open lessons have their parts and key terms free to read, and their quiz free with an account.

  1. Module 1 · 5 lessons · videos in production

    What Machine Learning Is

    Builds to: Better Than 25 mpg, From One Threshold
    1. 1.1What Is Machine Learning?Tell a program written from rules apart from a program learned from examples, and say what "learning" concretely means: parameters chosen to fit data.
    2. 1.2The Kinds of Machine LearningFrom the question being asked, tell whether a problem is regression, classification, clustering or something else.
    3. 1.3The Machine Learning WorkflowKnow the steps every project goes through, and what goes wrong when one is skipped.
    4. 1.4Samples, Features and LabelsTurn a real table into `X` and `y`, and name each column's type.
    5. 1.5Where Data Comes FromSee how collection and labelling decide what a model can learn, before any algorithm runs.
  2. Module 2 · 2 lessons · videos in production

    Exploring a Dataset for Modelling

    Builds to: A Data Report for UCI Online Shoppers Purchasing Intention
    1. 2.1Features Against the TargetUse per-class distributions and pairwise views to decide which features help predict the target, and which repeat each other.
    2. 2.2The Modelling Checks: Target, Leakage and Feature DecisionsBefore modelling an unseen table, check the target, find the columns that must not be used, and write the decisions a modeller acts on.
  3. Module 3 · 7 lessons

    Linear Regression and Gradient Descent

    Builds to: A Fuel-Economy Model, Built and Defended
    1. 3.1Simple Linear RegressionPredict a number from one feature with a straight line, choose the line that minimises squared error, and read what its slope and intercept say.Free video
    2. 3.2Gradient DescentFind the minimum of a loss without solving equations, by stepping against the gradient, and tell from the loss curve whether a run converges, crawls or diverges.Free video
    3. 3.3Gradient Descent for Linear RegressionDerive the gradient of the squared-error loss, see why one update reads every row, and know what stochastic and mini-batch descent buy.Free video
    4. 3.4Multiple Linear RegressionPredict from several features with one weight each, and read a coefficient as the change in the prediction with the other features held fixed.Video in production
    5. 3.5Why Gradient Descent Is Slow: Conditioning and Feature ScalingPredict from the data's shape how many updates descent will need, and see why scaling the features fixes it.Video in production
    6. 3.6Regression Diagnostics and Robust RegressionRead residual plots to find what a linear model gets wrong, tell an outlier from a point that controls the fit, and choose a loss that one bad row cannot dominate.Video in production
    7. 3.7CollinearitySee why correlated features make individual coefficients unstable while the predictions stay good, and measure how unstable they are.Video in production
  4. Module 4 · 10 lessons · videos in production

    The First Classifier, Generalisation and Regularisation

    Builds to: A Model-Selection Report
    1. 4.1Distance and SimilarityMeasure how alike two rows are, and see how the choice of measure and the feature scales change who counts as a neighbour.
    2. 4.2k-Nearest NeighboursClassify a new point by a vote of its nearest neighbours, and see what K and the distance do to the boundary.
    3. 4.3Overfitting, Underfitting and the Test SetKnow why a score on the training data is not evidence, and read the train/test gap as a diagnosis.
    4. 4.4Cross-ValidationEstimate how a model will do on unseen data from the training set alone, with a split that matches how the data was collected.
    5. 4.5Hyperparameter SearchChoose hyperparameters with a search that spends a fixed budget well, and report a score the search did not bias.
    6. 4.6Learning Curves and Validation CurvesDecide from two curves whether more data, more capacity or less capacity will help.
    7. 4.7Polynomial Regression: Choosing Model CapacityFit curves with a linear model through basis functions, and choose the degree by validation.
    8. 4.8Ridge RegressionPenalise the size of the weights to trade a little bias for less variance, and choose the penalty's strength by cross-validation.
    9. 4.9Lasso and Elastic NetUse an L1 penalty to drive some weights exactly to zero, and know when elastic net is the better choice.
    10. 4.10k-NN at Scale: kd-Trees and Hashing (optional)Find neighbours without comparing a query against every row.
      What it will cover
      • Brute force is O(nd) per query, measured as the table grows
      • kd-trees: building, querying, and why they fail in high dimensions
      • Locality-sensitive hashing for cosine and Euclidean distance
      • Approximate nearest-neighbour libraries named, as what serves embeddings today
      In production
  5. Module 5 · 5 lessons · videos in production

    Measuring a Model

    1. 5.1The Confusion Matrix, Precision and RecallCount the four outcomes, derive the rates from them, and see accuracy fail.
    2. 5.2Thresholds, ROC and AUCTreat a classifier's output as a score, read the trade every threshold makes, and compare models across all thresholds at once.
    3. 5.3Precision–Recall Curves and Choosing a ThresholdChoose the operating threshold from the cost of each error or the capacity to act, and tune it without touching the test set.
    4. 5.4Imbalanced DataKnow why the majority class wins by default, and what each fix costs.
    5. 5.5Evaluating a Regression ModelPick the error measure that matches the decision, and read the distribution of errors on held-out data, not only its average.
  6. Module 6 · 3 lessons · videos in production

    Probabilistic Classifiers

    1. 6.1Turning Text into NumbersTurn documents into vectors, and see what each representation keeps and loses.
    2. 6.2Naive BayesClassify by multiplying per-feature likelihoods under an independence assumption we know is false, and make it work in practice.
    3. 6.3Generative and Discriminative Models: LDA and QDAClassify by modelling each class as a Gaussian, and see why shared or separate covariances give linear or curved boundaries.
  7. Module 7 · 9 lessons · videos in production

    Linear Classifiers

    1. 7.1The PerceptronLearn a separating plane by correcting mistakes one at a time, and see why it stops only on separable data.
    2. 7.2Logistic RegressionSeparate two classes with a plane, turn the signed distance into a probability, and fit it by minimising log loss.
    3. 7.3Reading a Logistic RegressionRegularise a logistic regression and read its weights, knowing when a weight can be read as importance.
    4. 7.4More Than Two ClassesBuild multi-class classifiers from binary ones, or directly with softmax, and score them.
    5. 7.5Multi-Label Classification (optional)Predict several labels at once for one row, and measure it.
      What it will cover
      • Multi-class against multi-label
      • Binary relevance; classifier chains named
      • Hamming loss, micro and macro F1
      • Label frequency and the long tail
      In production
    6. 7.6Support Vector MachinesChoose the separating plane with the widest margin, and see C as the tolerance for violations.
    7. 7.7The Kernel TrickGet curved boundaries without building the features, and read what γ and the degree do.
    8. 7.8Beyond Squared Error: Poisson and Quantile RegressionChoose the loss that matches the target: counts, or a quantile instead of the mean.
    9. 7.9Case Study: Review SentimentTake a text-classification problem from business question to a compared set of models.
  8. Module 8 · 7 lessons · videos in production

    Preparing Data

    1. 8.1Missing ValuesChoose how to handle missing values by first asking why they are missing.
    2. 8.2Categorical FeaturesEncode categories as numbers without inventing an order or leaking the target.
    3. 8.3Scaling and Transforming FeaturesKnow which models need scaled features, and which transform fixes a skewed one.
    4. 8.4Feature EngineeringBuild the features a model cannot find by itself.
    5. 8.5Data Leakage and PipelinesFind the ways test or future information gets into training, and prevent them with a pipeline.
    6. 8.6The Curse of Dimensionality and Feature SelectionSee why distance and density break down as dimensions grow, and choose fewer features.
    7. 8.7Case Study: House PricesTake a regression problem from question to a tuned, leak-free pipeline, and justify the final model against a baseline.
  9. Module 9 · 6 lessons · videos in production

    Trees and Ensembles

    1. 9.1Decision TreesSplit the space with axis-parallel questions chosen by impurity, and control the tree's capacity with depth and leaf size, knowing that the right capacity depends on how many rows there are.
    2. 9.2Random ForestsAverage many deep trees grown on bootstrap samples, decorrelated by a random subset of features, to cut variance, and read the out-of-bag error.
    3. 9.3Gradient BoostingAdd trees one at a time, each fitting what is still wrong, and see it as gradient descent on the loss.
    4. 9.4Gradient Boosting in PracticeConfigure a modern gradient-boosting library well: a loss that matches the target, histogram splits, native categories and gaps, early stopping, a tuning order, and constraints.
    5. 9.5AdaBoost (optional)Boost by reweighting the rows the last learner got wrong.
      What it will cover
      • Stumps and sample weights
      • The learner's weight in the vote
      • Its link to exponential loss
      In production
    6. 9.6Stacking, Voting and CascadesCombine different models, and know when the combination earns its complexity.
  10. Module 10 · 4 lessons · in production

    Explaining Models

    1. 10.1Feature ImportanceMeasure which features a model relies on, and know when an importance score misleads.
      What it will cover
      • Model-specific importance: weights, impurity decrease
      • Permutation importance on held-out data
      • The correlated-features problem
      • Forward feature selection as an importance
      In production
    2. 10.2Partial Dependence and ICE PlotsSee how a prediction moves as one feature changes, on average and for each row.
      What it will cover
      • Partial dependence
      • Individual conditional expectation curves
      • Where they mislead: correlated features, extrapolation
      In production
    3. 10.3SHAP ValuesAttribute one prediction to its features fairly, and read the summary plots.
      What it will cover
      • Shapley values from a coalition game, computed by hand for three features
      • Local explanations, then global summaries
      • TreeSHAP; the cost for other models
      • What an explanation is not: causation
      In production
    4. 10.4Case Study: Credit DefaultBuild, tune and explain a tabular model for a costly, imbalanced decision.
      What it will cover
      • The cost of each error, and the metric that follows from it
      • Stats 2.4's data report as the starting point; its sealed holdout as the test set
      • Missing values and categorical features in a pipeline
      • Logistic regression → random forest → gradient boosting
      • Imbalance handling; the threshold from the costs
      • Explaining the final model
      In production
  11. Module 11 · 3 lessons · in production

    Dimensionality Reduction

    1. 11.1Principal Component AnalysisFind the directions of greatest variance, project onto them, and choose how many to keep.
      What it will cover
      • Standardise, then the covariance matrix
      • Maximum variance and minimum reconstruction error as the same objective
      • Explained variance; choosing the number of components
      • PCA for visualisation, and as preprocessing
      • Limits: linear directions only; scale sensitivity
      In production
    2. 11.2PCA: Why the EigenvectorsDerive that the covariance matrix's eigenvectors are PCA's answer.
      What it will cover
      • The constrained problem: maximise variance with ‖u‖ = 1
      • A Lagrange multiplier turns it into an eigen equation
      • Eigenvalues as variance explained; PCA through the SVD
      In production
    3. 11.3t-SNEEmbed high-dimensional data in 2-D by preserving neighbourhoods, and read the picture without over-reading it.
      What it will cover
      • Neighbourhoods as probabilities; perplexity
      • The crowding problem, and the heavy-tailed t distribution
      • What distances and cluster sizes in the plot do not mean
      • Several runs, several perplexities
      In production
  12. Module 12 · 5 lessons · in production

    Clustering

    1. 12.1K-MeansGroup unlabelled points around centroids by alternating two steps, and know where it fails.
      What it will cover
      • The objective: within-cluster squared distance (inertia)
      • Assign, then update; convergence to a local minimum
      • K-means++ initialisation
      • Choosing K: the elbow, the silhouette
      • Failure cases on labelled simulations: unequal sizes, unequal densities, non-globular shapes; K-medoids for other distances
      In production
    2. 12.2Hierarchical ClusteringBuild a tree of merges and cut it at the right height.
      What it will cover
      • Agglomerative and divisive
      • Single, complete, average and Ward linkage
      • Reading a dendrogram
      • Cost, and limitations
      In production
    3. 12.3DBSCANFind clusters as dense regions of any shape, with noise left out.
      What it will cover
      • eps and MinPts
      • Core, border and noise points
      • Density-reachable and density-connected
      • Choosing the hyperparameters; varying density as the weakness
      In production
    4. 12.4Gaussian Mixture Models and EMCluster softly, with each point getting a probability per cluster, fitted by expectation–maximisation.
      What it will cover
      • A mixture of Gaussians as a generative model; the joint contours of two measurements
      • The E step (responsibilities) and the M step (refit)
      • K-means as the hard, spherical special case
      • Choosing K with BIC
      In production
    5. 12.5Evaluating ClustersJudge a clustering with no labels, and with labels when they exist.
      What it will cover
      • Internal: silhouette, within against between spread
      • External: adjusted Rand index, purity
      • Stability across runs and samples
      • Usefulness downstream as the real test
      In production
  13. Module 13 · 3 lessons · in production

    Anomaly Detection

    1. 13.1Local Outlier FactorScore how isolated a point is relative to the density of its neighbours.
      What it will cover
      • A simple start: the mean distance to the k nearest neighbours
      • k-distance and reachability distance
      • Local reachability density; the LOF score
      In production
    2. 13.2Isolation ForestFind anomalies as the points random splits isolate fastest.
      What it will cover
      • Random trees; path length as the score
      • Why anomalies isolate early
      • Contamination, and choosing a threshold
      In production
    3. 13.3One-Class SVM (optional)Learn a boundary around normal data only.
      What it will cover
      • The one-class objective; ν as the outlier fraction
      • The RBF kernel's role
      • The three detectors compared on the same labelled frauds (the comparison closes 13.2 when this video is skipped)
      In production
  14. Module 14 · 4 lessons · in production

    Recommendations and Ranking

    1. 14.1Collaborative FilteringRecommend from similar users or similar items.
      What it will cover
      • Content-based against collaborative
      • The user–item matrix; sparsity
      • User–user and item–item similarity
      • Cold start
      In production
    2. 14.2Matrix FactorisationFactorise the rating matrix into user and item vectors and fill in the blanks.
      What it will cover
      • Latent factors
      • Regularised factorisation fitted by SGD
      • Biases; implicit feedback (SVD++ named)
      • Factorisation elsewhere: clustering, word vectors, eigenfaces
      In production
    3. 14.3Learning to Rank (optional)Optimise the order of results rather than each score.
      What it will cover
      • Pointwise, pairwise, listwise
      • NDCG and MAP
      • A ranking objective with gradient boosting
      In production
    4. 14.4Case Study: Movie RecommendationsPredict ratings and rank films, comparing neighbourhood, factorisation and boosted models.
      What it will cover
      • Temporal split; baselines (global mean, user and item biases)
      • Similarity models → matrix factorisation → boosted blend
      • RMSE and ranking metrics; cold-start behaviour
      In production
  15. Module 15 · 4 lessons · in production

    Time Series

    1. 15.1Time Series BasicsDecompose a series into trend, seasonality and noise, and measure its memory.
      What it will cover
      • Trend, seasonality, residual
      • Autocorrelation
      • Stationarity, and differencing
      In production
    2. 15.2Forecasting as RegressionTurn a series into a supervised table and validate it without seeing the future.
      What it will cover
      • Lag features and rolling windows
      • Walk-forward validation
      • The naive and seasonal-naive baselines
      • Multi-step forecasting
      In production
    3. 15.3Smoothing and ARIMAForecast with classical models, and know when they beat a regressor.
      What it will cover
      • Simple, weighted and exponential moving averages
      • Exponential smoothing with trend and season
      • ARIMA, named and fitted
      • Fourier features for seasonality
      • Pretrained forecasting models, named, and compared against the seasonal-naive baseline
      In production
    4. 15.4Case Study: Taxi DemandForecast demand per zone and time slot, end to end.
      What it will cover
      • Data cleaning: duration, speed and fare outliers
      • Grouping zones into regions; time binning
      • Baselines → linear → random forest → gradient boosting
      • MAPE and error analysis
      In production
  16. Module 16 · 2 lessons · in production

    Learning with Fewer Labels · (optional)

    1. 16.1Semi-Supervised Learning (optional)Use unlabelled data to help a classifier trained on few labels.
      What it will cover
      • Self-training, and its confirmation bias
      • Label propagation over a similarity graph
      • When unlabelled data helps, and when it hurts
      In production
    2. 16.2Active Learning (optional)Choose which rows to label next so each label teaches the most.
      What it will cover
      • Uncertainty sampling
      • Query by committee
      • The labelling-budget curve against random labelling
      In production
  17. Module 17 · 10 lessons · in production

    Models in the Real World

    1. 17.1Probability CalibrationCheck whether "90% sure" is right 90% of the time, and fix it when it is not.
      What it will cover
      • Reliability diagrams, and the Brier score beside log loss (named in Stats 7.2)
      • Platt scaling
      • Isotonic regression
      • Calibrating an already-fitted model with FrozenEstimator
      • Which models come out miscalibrated, and why (boosting, class weights, resampling)
      In production
    2. 17.2Is Model B Really Better?Put an interval on a score and test a difference before claiming an improvement.
      What it will cover
      • Bootstrap confidence intervals for a metric
      • Paired comparisons on the same folds
      • McNemar's test
      • The variance of a cross-validation score
      In production
    3. 17.3From Notebook to ProductionKnow what changes when a model's predictions have consequences.
      What it will cover
      • Saving and loading a model with its pipeline; why a pickle from an untrusted source is unsafe to load
      • Batch against online prediction; latency budgets
      • Serving behind an API
      • Feature consistency between training and serving
      In production
    4. 17.4Rolling Out a New Model: Shadow, Canary and A/BReplace a deployed model safely: check it on live inputs without acting on them, expose it to a small share of traffic, then decide with an A/B test designed as Stats 6.4 teaches.
      What it will cover
      • Shadow deployment: the new model scores live requests and its answers are logged, not used; offline and live disagreement measured
      • Canary release: a small share of traffic, guardrail metrics, and the rollback rule decided in advance
      • The A/B decision itself, using Stats 6.4's design (unit, primary metric, interval) without re-teaching it
      • What is specific to models: feedback loops (the model changes the data it is later trained on), novelty effects, and a model that wins offline and loses live
      In production
    5. 17.5Monitoring, Drift and RetrainingDetect when the world has moved away from the training data, and decide when to retrain.
      What it will cover
      • Data drift against concept drift: 2011's model meeting 2012's riders
      • Monitoring inputs, outputs and delayed labels
      • Detecting drift with distributions, rates and time plots; the KS test (named in Stats 6.2) as one diagnostic
      • Retraining schedules against triggers
      In production
    6. 17.6Reproducibility and Experiment TrackingMake every result re-runnable and every experiment comparable.
      What it will cover
      • Seeds, versions and environments
      • Data and model versioning
      • Logging experiments and comparing runs with MLflow
      In production
    7. 17.7FairnessMeasure whether a model's errors fall unevenly across groups, and what each fairness criterion trades away.
      What it will cover
      • Protected attributes and proxies
      • Demographic parity, equal opportunity, calibration within groups
      • Why they cannot all hold at once when base rates differ
      • Mitigation before, during and after training
      In production
    8. 17.8Privacy (optional)Know how a model can leak its training data, and the basic protections.
      What it will cover
      • Memorisation and membership inference, measured on an overfitted model
      • Anonymisation, and why it fails
      • Differential privacy, the idea
      In production
    9. 17.9Prediction Intervals and Sets: Conformal PredictionAttach a guaranteed coverage level to any model's predictions, as an interval for regression or a set of labels for classification.
      What it will cover
      • Split conformal prediction: calibration scores from held-out data
      • The coverage guarantee, and the assumption it rests on (exchangeable data)
      • Intervals for regression; label sets for classification
      • Comparison with quantile regression on the same data
      In production
    10. 17.10Choosing an AlgorithmChoose a first model and a shortlist for a new problem from the data, the constraints and the cost of error, using what every earlier model showed.
      What it will cover
      • The loss chart, completed: squared, absolute, Huber, log, hinge, Poisson, pinball, exponential
      • The cost table: training and prediction cost for every model in the course
      • From the data to a shortlist: tables, text, few rows, many features, unlabelled
      • Constraints that decide: interpretability, latency, calibration, monotonicity
      • What does not change: the baseline, the split, cross-validation, the test set used once
      • Where deep learning takes over, and which ideas from this track it builds on
      In production
  18. Module 18 · 2 lessons · in production

    More Case Studies · (optional)

    1. 18.1Case Study: Human Activity Recognition (optional)Classify activities from phone-sensor features with classical models.
      What it will cover
      • Sensor data and windowed features
      • t-SNE for EDA
      • Multi-class logistic regression, SVM, random forest
      In production
    2. 18.2Case Study: Friend Recommendation (optional)Predict missing links in a social graph with engineered graph features.
      What it will cover
      • Link prediction as binary classification; sampling negatives
      • Graph features: Jaccard, Adamic–Adar, PageRank, shortest path, SVD features
      • Gradient boosting on those features
      In production

How Machine Learning is taughtone lesson, opened up.

Lessons in this track are built the same way. Here is ML 3.2 as its outline lists it: what it builds on, its parts in order, and everything around it in its module.

ML 3.2 Free video

Gradient Descent

Find the minimum of a loss without solving equations, by stepping against the gradient, and tell from the loss curve whether a run converges, crawls or diverges.

The lesson, part by part
  1. A loss with no formula
  2. One parameter, then two
  3. Searching a grid
  4. Stepping against the derivative
  5. The learning rate decides
  6. Two parameters on the cars
  7. Just above the limit
  8. The descent loop in NumPy
  9. Recap, your challenge, and what comes next

Key term · update rulew ← w − η · L′(w)

After the lesson
  • A 5-question quiz, marked the moment you answer
  • Practice at levels A to C, with values to check against
  • Where the idea is used in real work
  • Common mistakes: the error you will see, why, and the fix
In its module · 3. Linear Regression and Gradient Descent
  • 3 notebooks to run the examples yourself
  • 15 interview questions with model answers
  • The module project: A Fuel-Economy Model, Built and Defended, set with no template

What's inside a lessonin Machine Learning, published so far.

Counted from this track's published lessons. A part still being written is left out until it is published.

  1. Learn

    The lesson

    Short parts, each with its key terms, and a free video where one is recorded.

    51 lessonsNo account
  2. Check yourself

    Quiz

    Multiple-choice questions on the lesson, marked the moment you answer.

    23 lessonsFree account
  3. Practise

    Assignments

    Exercises to do yourself, starting from the lesson's own challenge.

    23 lessonsPro
  4. Apply it

    Real-world applications

    Where each idea is used in real work, from data analysis to production models.

    23 lessonsPro
  5. Avoid

    Common mistakes, and the fix

    The error you will actually see, why it happens, and how to fix it.

    23 lessonsPro
  6. Prepare

    Interview questions

    Questions an interviewer asks about each module, with model answers.

    60 questionsPro
  7. Build

    Projects and notebooks

    Module projects, set as a problem with no template and checked by a notebook, and notebooks to run the examples yourself.

    4 projects, 15 notebooksPro

What you will build4 module projects, each set with no template.

Each project is a problem to solve on your own, then checked against test values or a notebook.

Start free, go further with Pro

Compare the plans

Free

In Machine Learning:

  • The 51 open lessons' parts and key terms, no account
  • 3 free video lessons
  • Quizzes and saved progress with a free account
  • Every layer of module 1, the free sample
Start with 1.1 What Is Machine Learning?
Pro

Pricing announced soon.

  • Every course, from Python to deep learning and generative AI
  • Practice problems for every lesson, levels A to C, with values to check
  • Self-checking notebooks that mark your answers as you go
  • Module projects, cheat sheets, common mistakes and interview answers
  • A certificate for every course you complete
  • Weekly live sessions with Gaurav
  • Everything in Free

Worked articles on Machine Learning

All Machine Learning resources

Where Machine Learning is used

All AI applications

Questions about Machine Learning

Do I need to know advanced maths?

No. Each lesson re-establishes the maths it needs, and links the Maths or Statistics lesson that goes deeper.

Does the course cover deep learning?

This track covers classical machine learning completely. Deep learning has its own course, Deep Learning with PyTorch, which follows this one, and Generative AI follows that. Both are taught the same way, and their syllabuses list every planned lesson.