
In this lecture:
- Four classical definitions of AI
- Narrow, general and super-intelligence
- AI versus ordinary software: where the rules come from
- The agent view: percepts, actions, performance measure
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- 1950-1956: the imitation game and the Dartmouth proposal
- The perceptron, its limits and the first winter
- Expert systems, brittleness and the second winter
- 2012 onwards: data, GPUs and deep learning
- Attention, large language models and agents
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Propositions, connectives and truth tables
- Inference: modus ponens and forward chaining
- Knowledge base + inference engine = expert system
- Why rule systems become brittle
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- One map: AI, ML, deep learning, generative AI, agents
- Supervised, unsupervised, self-supervised and reinforcement learning
- Tasks: regression, classification, clustering, generation, control
- The road ahead in this course
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Installing Python and creating a project folder
- Jupyter notebooks: cells, kernels, execution order
- Cloud notebooks: GPU runtime, files, saving work
- Reproducibility habits from day one
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- What a program is: instructions, state, output
- Why Python dominates AI
- Your first script and the anatomy of a traceback
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Names, objects and types: int, float, str, bool, None
- Explicit conversion and its failure modes
- Why 0.1 + 0.2 is not 0.3: binary fractions
- Operators and precedence
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Input and formatted output with f-strings
- Indexing and slicing, immutability
- String methods and Unicode (Devanagari, emoji, normalisation)
- Regular expressions: patterns, groups, validation
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- if / elif / else and truthiness
- match statements for structured decisions
- for loops, range and enumerate
- while, break, continue and loop invariants
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Lists: creation, mutation, slicing, sorting
- Aliasing versus copying: shallow and deep copies
- Tuples, unpacking and nested structures
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Dictionaries: keys, values, iteration, get and setdefault
- How hashing makes lookup O(1) on average
- Sets and set algebra
- Choosing the right container
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Defining functions; defaults, keywords and docstrings
- *args and **kwargs
- Scope (LEGB) and closures
- Recursion: base case, call stack, memoisation
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- List, dict and set comprehensions
- lambda, sorted with keys, map, filter, zip
- any, all, min/max with key
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Importing and the standard library tour
- pip, virtual environments and requirements files
- Structuring a small package
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Reading and writing text and CSV files
- JSON: the data language of APIs
- Exceptions: try / except / else / finally, custom errors
- Logging levels instead of print
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Classes, objects, attributes and methods
- Building a Neuron class
- Inheritance and super()
- Special methods: __repr__, __eq__, __add__, __len__
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Type hints and static checking
- dataclasses for clean records
- Pydantic models: validation and serialisation
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- How HTTP works: methods, status codes, headers
- Calling REST APIs and handling failures
- async / await and concurrency for I/O
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Big-O notation and growth rates
- Stacks, queues, heaps and graphs
- Binary search, sorting algorithms
- Systematic debugging
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Command-line essentials
- pytest: tests, fixtures, parametrisation
- Git and GitHub: commits, branches, pull requests
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this assignment you practise the most important habit from the lecture on functions and
recursion: describing a problem in terms of smaller copies of itself, and then making that
description fast with memoisation. The habit matters far beyond these puzzles, because dynamic
programming in sequence models and in reinforcement learning is built on exactly the same idea.
You will solve three problems: tiling a floor, counting change in rupee coins and flattening
nested lists.
Learning goals:
- Find a recursive description of a problem, with base cases that you can justify.
- Avoid double counting by structuring a recursion so that its cases are disjoint.
- Add memoisation with functools.lru_cache or a dictionary, and choose the right cache key.
- Measure running time reliably and explain an exponential versus a linear growth curve.
Everything you need is in the attached zip. Read README.md first.
In this assignment you build kirana, a small inventory library for a neighbourhood kirana store,
the kind of shop that sells rice, dal, tea and soap. It brings together everything from this
part of the course: dataclasses and type hints, validation with Pydantic, logging, a command-
line interface, and a test suite that proves the code works. This matters because every serious
AI system, from a data pipeline to an agent, is ordinary software underneath, and it must be
just as reliable.
Learning goals:
- Model data with a dataclass and validate untrusted input with a Pydantic model.
- Represent money exactly with decimal.Decimal.
- Design and raise your own exception hierarchy.
- Log every state change through the logging module, without configuring logging inside a library.
- Build a command-line interface with argparse and meaningful exit codes.
- Write a pytest suite with fixtures and parametrisation, and measure its line coverage.
- Keep a clean Git history of small, focused commits.
Everything you need is in the attached zip. Read README.md first.
RailRoute is a command-line and notebook application that plans the cheapest, fastest and
fewest-change journeys across a synthetic national rail network. It validates bookings and
identifiers, and checks the simulated live status of several trains at once. text $ railroute
plan VSH OJW --by fare Journey VSH -> OJW (optimised for fare) 1. 53999 Jayapuram - Chandragarh
Passenger VSH 07:37 -> CHG 10:34 132.8 km Rs 49 2. 59852 Vasukhed - Beladih Passenger CHG 16:45
-> OJW 20:31 169.5 km Rs 64 Total: 12 h 54 min, 1 change(s), 302.3 km, Rs 113
Everything you need is in the attached zip. Read README.md first.
In this lecture:
- A model as a function from inputs to outputs
- Lines: slope and intercept as parameters
- Vectors as arrows and as lists of features
- Feature vectors in NumPy
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Adding and scaling vectors geometrically
- Linear combinations: mixing ingredients
- Norms L1, L2, L-infinity and what each measures
- Distance and why feature scaling matters
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- The dot product algebraically
- Deriving a.b = |a||b|cos(theta) from the law of cosines
- Cosine similarity for comparing items
- Projection onto a vector
- Orthogonal bases and Gram-Schmidt
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Matrices as tables of data
- An image is a matrix
- Matrix multiplication, entry by entry
- Four views: row, column, outer product, block
- Loops versus the @ operator
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Matrices move space: stretch, shear, reflect
- Rotation matrices derived
- Composition is multiplication (order matters)
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Span and linear independence
- Basis and dimension
- Rank
- Column space, null space and redundant features
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- The determinant as signed area
- Computing determinants: 2x2, 3x3, cofactors
- Zero determinant means collapse
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Gaussian elimination step by step
- The inverse and why we rarely compute it
- Least squares as projection
- The normal equation in code
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Eigenvectors visually: directions that do not turn
- Finding eigenvalues by hand: the characteristic polynomial
- Diagonalisation and repeated application
- PageRank as an eigenvector
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Symmetric matrices have orthogonal eigenvectors
- Quadratic forms and positive definiteness
- The covariance matrix and its ellipse
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- SVD: rotate, stretch, rotate
- Computing an SVD by hand for a 2x2 matrix
- Eckart-Young: best low-rank approximation
- Compressing an image
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Tensors and shapes: batch, channel, height, width
- Broadcasting rules
- einsum as a universal language for tensor operations
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this assignment you fit a straight line to six data points, first with pen and paper and then
in code. Fitting a line is the simplest case of linear regression, and linear regression is
least squares. By doing it by hand once, you will see that the best line is really a projection:
the same idea you met in the lectures on the dot product and on solving linear systems, where a
vector drops perpendicularly onto a plane.
Learning goals:
- Build a design matrix with an intercept column and explain what each column does.
- Form $X^\top X$ and $X^\top y$ from simple column sums and solve the normal equation by hand.
- Verify a hand result with np.linalg.lstsq.
- Show that the least-squares residual is orthogonal to the column space, and explain why the computed dot products are tiny rather than exactly zero.
- Connect the fitted line to the projection of $y$ onto the column space of $X$.
Everything you need is in the attached zip. Read README.md first.
In this assignment you build a small workbench for eigenvalues and singular values. Eigenvectors
tell us what a matrix does when it is applied again and again, and singular values tell us how
much of a matrix we can throw away while keeping what matters. These two ideas sit underneath
ranking, principal component analysis and model compression. The assignment follows the lectures
on eigenvalues and eigenvectors and on the singular value decomposition.
Learning goals:
- Find eigenvalues and eigenvectors of a 2 x 2 matrix from its characteristic polynomial.
- Use the trace and determinant rules to check eigenvalues.
- Implement power iteration with matrix-vector products only, and measure its convergence.
- Explain why convergence depends on the ratio of the top two eigenvalues.
- Use one SVD to compute every rank-k approximation error, and confirm the Eckart-Young prediction from the discarded singular values.
Everything you need is in the attached zip. Read README.md first.
In this lecture:
- Change at an instant: the limit idea
- The derivative from first principles
- Power, product, quotient rules derived
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- exp, log, sigmoid, tanh, ReLU derivatives
- The chain rule derived and visualised
- Nested functions as pipelines
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Computational graphs
- Forward and reverse mode
- Building a tiny autograd engine (a Value class)
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Partial derivatives
- The gradient as the direction of steepest ascent
- The Jacobian for vector-valued functions
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Layout conventions and identities
- Gradient of a loss with respect to a weight matrix
- Checking shapes as a correctness test
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Taylor series and local approximation
- The Hessian and curvature
- Convex functions and why they are easy
- Classifying critical points
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Gradient descent: the idea
- Derivation and three steps by hand
- Learning rates: too small, too large, just right
- Stochastic and mini-batch gradient descent
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Equality constraints and Lagrange multipliers
- Geometric meaning: gradients aligned
- Inequality constraints and KKT
- Where these appear in ML (SVMs, max-entropy)
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Hill climbing and its traps
- Simulated annealing and the temperature schedule
- Genetic algorithms: selection, crossover, mutation
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Integrals as accumulated area
- The fundamental theorem of calculus
- Numerical integration: trapezoid and Simpson
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this assignment you grow the small automatic differentiation engine built in the lecture on
computational graphs and automatic differentiation into one that can train a real neuron. This
matters because every deep learning framework is, at its heart, the same idea: a set of
primitive operations, each with a correct local derivative, glued together by reverse mode.
Learning goals:
- Implement forward values and backward rules for new primitive operations.
- Build a new operation from existing ones so that the chain rule does the work.
- Verify gradients with central finite differences and a relative-error test.
- Train a single tanh neuron with plain gradient descent on a squared-error loss.
- Understand why gradients must be reset before every backward pass.
Everything you need is in the attached zip. Read README.md first.
The learning rate decides whether gradient descent crawls, converges or explodes, and the
curvature of the loss sets that boundary. In this assignment you build a small optimiser
laboratory. You implement full-batch gradient descent, stochastic gradient descent and mini-
batch gradient descent from scratch, sweep the learning rate, and measure where training breaks
down. You then explain the boundary from the Hessian. You will use this skill every time you
train a model.
Learning goals:
- Implement GD, SGD and mini-batch GD in NumPy with one shared, well-tested gradient.
- Verify an analytic gradient against central finite differences.
- Run and present a learning-rate sweep on a logarithmic grid.
- Compute a Hessian, find its largest eigenvalue, and predict the divergence threshold
- Explain why stochastic methods behave differently from full-batch GD.
Everything you need is in the attached zip. Read README.md first.
In this lecture:
- Frequentist and Bayesian meanings
- Sample spaces, events and the axioms
- Verifying rules by simulation
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Permutations and combinations derived
- Binomial coefficients and Pascal's triangle
- Counting in code without overflow
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Conditional probability derived
- Independence and conditional independence
- The law of total probability
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Bayes' theorem derived from the product rule
- The base-rate fallacy with natural frequencies
- Bayesian networks: structure and inference
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Random variables, PMF and CDF
- Bernoulli, binomial and geometric derived
- Poisson and categorical in code
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Densities: probability for continuous quantities
- The normal distribution and z-scores
- The exponential distribution and memorylessness
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Expectation and its linearity
- Variance and covariance derived
- Joint, marginal and conditional distributions
- The multivariate normal
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Summary statistics and robust alternatives
- Correlation coefficients
- Correlation is not causation: confounders and Simpson's paradox
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Samples and the bootstrap
- Confidence intervals derived
- Hypothesis tests and p-values
- Designing and analysing an A/B test
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Likelihood versus probability
- Deriving maximum likelihood estimates
- MSE from Gaussian noise; log loss from Bernoulli
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Priors and posteriors
- MAP estimation derived
- MAP is regularisation (Gaussian prior = L2)
- Bayesian updating with conjugate priors
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Markov chains and stationary distributions
- Monte Carlo estimation
- Metropolis-Hastings derived and coded
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Information and entropy derived
- Cross-entropy and perplexity
- KL divergence and mutual information
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
A warning light is on: what is most likely wrong? Maintenance teams face this question every
day. In this assignment you build a small Bayesian network for an equipment-failure scenario and
reason from symptoms back to causes. The machine is an escalator at a busy metro station. It is
the same reasoning used for the tsunami sensor in the lecture on Bayes' theorem, now applied to
a machine. You compute three posterior queries exactly by enumeration and then confirm them by
simulation.
Learning goals:
- Turn a verbal scenario into a directed acyclic graph and justify every arrow and every missing arrow.
- Write conditional probability tables with sensible, clearly stated numbers.
- Build the joint distribution from the network factorisation and check that it sums to one.
- Answer posterior queries exactly by enumeration.
- Confirm the answers by rejection sampling, with accepted counts and standard errors.
- Recognise explaining away between two causes that share a common effect.
Everything you need is in the attached zip. Read README.md first.
You are the analyst for an online experiment. A new sign-up screen has been tested against the
current one, and you receive a synthetic A/B test dataset. Your task is to turn it into a clear,
honest decision. This matters because almost every product change in a machine-learning system,
from a new ranking model to a new screen, is judged by an experiment of exactly this kind. You
will use the bootstrap, confidence intervals, hypothesis tests and power analysis together.
Learning goals:
- Check an experiment's integrity (sample ratio, duplicates, missing values) before analysing it.
- Build a bootstrap confidence interval for a difference of two proportions, resampling each arm separately.
- Run and interpret a two-proportion z-test, and confirm it with a permutation test.
- Compute the sample size needed for a target lift, and judge whether an experiment was large enough.
- Communicate a statistical result to a non-technical decision-maker without misstating what a p-value means.
Everything you need is in the attached zip. Read README.md first.
Most training loops you will write are optimisers minimising a negative log-likelihood or a
negative log posterior. If you can derive a small case on paper and confirm it in code, you will
trust, and be able to debug, the large cases. In this assignment you derive three estimators by
hand and check each one with a numerical optimiser.
Learning goals:
- Write a log-likelihood as a sum and differentiate it to obtain a maximum likelihood estimate.
- Derive a MAP estimate under a conjugate Beta prior and relate it to the MLE.
- Confirm a stationary point is a maximum with a second-derivative check.
- Verify closed forms numerically with scipy.optimize, keeping parameters in their valid range.
- Quantify how the influence of a prior fades as the sample grows.
Everything you need is in the attached zip. Read README.md first.
In this lecture:
- Arrays and vectorisation (why loops are slow)
- Indexing, slicing and boolean masks
- Broadcasting, axes and random number generation
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- DataFrames and loading data
- Selecting, filtering and sorting
- Cleaning: missing values, types, duplicates, outliers
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- groupby: split-apply-combine
- pivot, melt and stack
- Merging and joining tables
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- SELECT, WHERE, ORDER BY
- GROUP BY and JOINs
- Window functions
- SQL from Python (sqlite3 and pandas)
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Choosing the right chart
- Matplotlib and Seaborn
- The EDA checklist
- A complete EDA walkthrough
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Train/validation/test splits and data leakage
- Scaling and encoding
- Feature engineering
- Where training data comes from: collection, labelling, licensing
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this assignment you take three messy tables and turn them into one clean, well-understood
dataset that is ready for a model. This is the everyday work behind every machine-learning
system, and it uses everything practised in this section: cleaning, joining, querying, exploring
and splitting without leakage. The three CSV files describe a small online grocery service.
There is a customers table, an orders table and a products table, linked by customer and product
IDs. They contain mixed formats, missing values, duplicates and at least one broken key. Your
target is whether a customer orders again within thirty days (reorder_30d), with one order as
the modelling unit.
Learning goals:
- Diagnose a table from its data types and its unusual values, then clean it with every decision logged.
- Join tables safely: predict row counts, validate key relationships and expose unmatched keys.
- Answer the same questions in SQL (SQLite, including window functions) and in pandas, and prove the answers agree.
- Run a disciplined exploratory analysis whose findings each carry a number and a modelling consequence.
- Build a train/test split that is free of leakage, and justify every excluded column.
Everything you need is in the attached zip. Read README.md first.
A reproducible analysis of district-level monsoon rainfall that combines SQL, pandas, linear
algebra, probability and inference to answer five research questions, each with a number, its
uncertainty and its meaning for a real decision.
In this lecture:
- Learning from data: the T-P-E definition
- The recipe: data, model, loss, optimiser, evaluation
- Generalisation as the real goal
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Residuals and the best line
- MSE with many features in matrix form
- The normal equation derived with calculus
- The gradient of MSE
- Linear regression from scratch
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Turning a linear model into a curve-fitter
- Fitting curves of every degree
- Capacity and the first look at overfitting
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- The sigmoid and log-odds
- Log loss derived from likelihood
- Deriving the logistic gradient
- Logistic regression from scratch
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Softmax derived and its gradient
- Categorical cross-entropy
- Softmax regression on a multiclass dataset
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Estimators, fit / predict / transform
- Rebuilding our models in scikit-learn
- Reading documentation effectively
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Train, validation, test and k-fold cross-validation
- Regression metrics: MAE, RMSE, R-squared derived
- Baselines: the model you must beat
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Underfitting and overfitting
- Deriving the bias-variance decomposition
- Learning and validation curves
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Confusion matrix, precision, recall, F1
- Thresholds and precision-recall curves
- ROC and AUC
- Calibration and reliability diagrams
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Why penalise large weights
- Deriving ridge regression in closed form
- Lasso and sparsity, geometrically
- Regularisation paths in code
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Naive Bayes by hand
- Naive Bayes from scratch
- k-nearest neighbours
- The curse of dimensionality
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Maximum margin
- Deriving the SVM (primal and dual)
- The kernel trick
- SVMs in code
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- How a tree asks questions
- Gini impurity and information gain derived
- A decision tree from scratch
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Bagging and why averaging reduces variance
- Random forests
- Boosting and AdaBoost
- Gradient boosting derived; XGBoost
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- PCA: the idea
- Deriving PCA from variance maximisation
- t-SNE and UMAP for visualisation, and their pitfalls
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- k-means and its objective
- Hierarchical clustering and DBSCAN
- Gaussian mixtures and the EM algorithm derived
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Kinds of anomalies
- Statistical, distance and isolation-based detectors
- Evaluating detectors with few labels
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Content-based and collaborative filtering
- Matrix factorisation derived
- Building a recommender and evaluating it
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Trend, seasonality and stationarity
- AR and ARIMA derived
- Forecasting with proper backtesting
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Global versus local explanations
- Shapley values derived
- SHAP and LIME in code, and their limits
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Pipelines and ColumnTransformer
- Hyperparameter tuning: grid, random, Bayesian; AutoML
- Imbalanced data and leakage in practice
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this assignment you build the two workhorses of classical machine learning with your own
hands: linear regression and logistic regression, both trained with vectorised gradient descent.
Nearly every model you will meet later, including neural networks, is trained by exactly this
loop of prediction, error, gradient and update. If you can write it correctly here and verify
it, training larger models will feel familiar.
Learning goals:
- Write the mean squared error and the log loss, and their gradients, in matrix form.
- Implement batch gradient descent with no Python loop over rows.
- Standardise features for optimisation and convert the weights back to original units.
- Verify gradients numerically, and verify a whole fit against scikit-learn to three decimal places.
- Recognise when a library solves a different problem from yours, such as a default penalty, and make both solve the same one.
Everything you need is in the attached zip. Read README.md first.
A classifier is a score plus a threshold, and the right threshold comes from the costs of each
kind of mistake, provided the probabilities can be trusted. In this assignment you choose the
operating threshold for a screening classifier used at a community health camp, and you defend
that choice with evidence. A missed case may mean a disease found too late; a false referral
means an extra confirmatory test and some worry. Your job is to turn those costs into a decision
rule that a hospital manager can follow. It builds directly on the lecture on classification
metrics: confusion matrix, precision-recall, ROC and calibration.
Learning goals:
- Compute the expected cost of a decision rule from a confusion matrix and a cost matrix.
- Use a reliability diagram and the Brier score to decide whether probabilities can be trusted, and fix calibration when they cannot.
- Keep a clean separation between training, validation (all choices) and test (one final look).
- Explain a threshold choice in plain language.
Everything you need is in the attached zip. Read README.md first.
In this assignment you build, with your own hands, the two models from the lectures on decision
trees and on ensembles: a classification tree grown with the Gini impurity, and a random forest
made from it. Writing them yourself is the best way to see why a single tree is unstable and why
averaging decorrelated trees fixes that. You then compare both with scikit-learn under the same
settings and explain every difference you see.
Learning goals:
- Compute the Gini impurity and the weighted Gini decrease of a binary threshold split.
- Implement greedy, recursive CART growth with max_depth and min_samples_leaf.
- Implement bagging (bootstrap samples of rows) and feature sub-sampling at every split.
- Compute an honest out-of-bag (OOB) accuracy estimate.
- Run a fair comparison with a library implementation and explain the differences.
Everything you need is in the attached zip. Read README.md first.
You act as a data scientist who has been handed customer data with no labels at all, and asked a
simple question: what kinds of customers do we have? You use the four tools from the lectures on
dimensionality reduction and clustering (principal component analysis, k-means, DBSCAN and
Gaussian mixtures) and write a short report that defends the number of groups you choose.
Without labels, the hardest part of clustering is not running the algorithm. It is justifying
the answer.
Learning goals:
- Clean and scale features for distance-based methods, and explain each choice.
- Use PCA to measure how much structure a low-dimensional map can show.
- Run k-means over a range of k, a Gaussian mixture over a range of components, and DBSCAN with eps chosen from a k-distance plot.
- Weigh the elbow, the silhouette, BIC and cluster stability (adjusted Rand index) when they disagree.
- Describe clusters in plain business language.
Everything you need is in the attached zip. Read README.md first.
AirSense is an end-to-end classical machine-learning system that forecasts tomorrow's pollutant
concentration, decides whether tomorrow deserves a severe-air alert using an explicit cost
matrix, and explains every alert it raises. It is the closing project of the classical machine
learning part of the course and brings together time-aware validation, regression, cost-
sensitive classification, calibration, clustering, anomaly detection, pipelines with
hyperparameter search, and SHAP explanations.
Everything you need is in the attached zip. Read README.md first.
In this lecture:
- The perceptron and its learning rule
- Perceptron convergence and limits
- The modern neuron: weights, bias, activation
- A neuron in code
In this lecture:
- XOR and why one neuron fails
- Hidden layers bend space
- Forward propagation by hand
- Vectorised forward pass and parameter counts
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Why networks need non-linearity (proof by collapse)
- The activation zoo: sigmoid, tanh, ReLU, GELU, SiLU
- Losses for regression and classification
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- The intuition: credit assignment
- Backpropagation by hand on a tiny network
- The four backpropagation equations in matrix form
- Softmax + cross-entropy shortcut and gradient checking
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Momentum derived as an exponential moving average
- RMSProp and Adam derived (with bias correction)
- Learning-rate schedules, warm-up and gradient clipping
- An optimiser race
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Weight decay and early stopping
- Dropout as an ensemble
- Data augmentation
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Vanishing and exploding gradients
- Xavier and He initialisation derived
- BatchNorm and LayerNorm
- Residual connections
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Tensors, dtypes and devices
- Autograd and the dynamic graph
- nn.Module and building models
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Training and validation loops
- Datasets and DataLoaders
- GPUs, checkpoints and reproducibility
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- A systematic debugging checklist
- Overfit one batch first
- Fixing five bugs in one training script
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- The universal approximation theorem
- Why depth helps
- Looking inside: features and representations
- Self-supervised, contrastive and other paradigms
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Keras: the high-level API
- TensorFlow versus PyTorch; TF Lite for devices
- JAX: grad, jit, vmap and functional purity
- Training an MLP with Flax and Optax
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this assignment you compute every gradient of a small softmax network by hand, and then prove
your answers correct with a finite-difference check in NumPy. This is the skill that makes
backpropagation yours: once you have done it carefully for one small network, the four matrix
equations from the lecture on backpropagation stop being formulas to memorise and become steps
you understand.
Learning goals:
- Carry out a forward pass through a sigmoid hidden layer and a softmax output by hand.
- Use the softmax-plus-cross-entropy shortcut $\delta^{[2]} = p - y$.
- Backpropagate the error through a weight matrix and a sigmoid, keeping track of shapes.
- Implement central differences and a relative-error check, and read what the numbers mean.
Everything you need is in the attached zip. Read README.md first.
In this lecture:
- How computers see: pixels and channels
- Convolution visually
- Convolution by hand and the output-size formula
- Convolution from scratch
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Anatomy of a CNN: conv, pooling, heads
- Feature maps and parameter counts
- Training a CNN in PyTorch
- Augmentation and error analysis
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- LeNet, AlexNet, VGG, Inception
- ResNet and skip connections derived
- MobileNet and EfficientNet ideas
- Building a small ResNet
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Why pretrained features transfer
- Feature extraction versus fine-tuning
- Fine-tuning in code with a learning-rate split
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Bounding boxes, IoU and non-max suppression derived
- Two-stage and one-stage detector families; mAP
- Object detection with a YOLO-family model
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Semantic, instance and panoptic segmentation
- U-Net and Mask R-CNN
- Pose estimation and OCR pipelines
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Colour spaces, thresholds and morphology
- Contours and geometric transforms
- When classic methods beat deep learning
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
Every convolutional network you build depends on two calculations: the output size of each layer
and the number of parameters it learns. If either is wrong, the network will not even run, or it
will run with a head ten times larger than you intended. In this assignment you practise both
until they are automatic. You fill a shape table for five layer stacks by hand, implement the
formulas in a small module, and confirm every number with a PyTorch summary. It follows the
lecture on images as data and the convolution operation (and uses the PyTorch layers introduced
in the lecture on convolutional network architecture and training).
Learning goals:
- Apply the output-size formula $\lfloor (n + 2p - k)/s \rfloor + 1$ to convolution and pooling layers, one dimension at a time.
- Count the weights and biases of convolutional and fully connected layers.
- Explain why a convolution's parameter count does not depend on the image size, while the fully connected layer after a flatten step depends on it very strongly.
- Build a layer stack in PyTorch, pass a correctly shaped dummy tensor through it and read a summary of output shapes and parameter counts.
- Diagnose a mismatch between a hand calculation and a framework's output.
Everything you need is in the attached zip. Read README.md first.
Your job this time is to take a network pretrained on a large dataset (ImageNet) and adapt it to
a small one, a few hundred satellite tiles of five land-cover classes, and then do what good
practitioners always do next: study its mistakes. A model that reaches a decent accuracy is only
half the job; knowing why it fails tells you what to fix. The assignment follows the lecture on
transfer learning and fine-tuning and uses its two-stage recipe.
Learning goals:
- Use the correct preprocessing for pretrained weights (input size, scaling, ImageNet normalisation) and keep evaluation transforms deterministic.
- Fine-tune in two stages: a new head on a frozen backbone, then the whole network with a smaller learning rate for the backbone than for the head.
- Make every modelling decision on a validation set and touch the test set once.
- Build and read a confusion matrix row by row.
- Rank test examples by loss and inspect the worst errors.
- Write an evidence-based diagnosis with one concrete fix per error pattern.
Everything you need is in the attached zip. Read README.md first.
In this lecture:
- Why language is hard for machines
- Tokenisation: words, sub-words, characters
- Normalisation, lemmatisation and spaCy pipelines
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Bag of words
- TF-IDF derived
- A sentiment classifier
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Language modelling as next-token prediction
- n-gram models derived
- Smoothing, perplexity and generation
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- The distributional hypothesis
- Exploring pretrained embeddings
- Skip-gram and negative sampling derived
- Training word2vec yourself
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- GloVe and fastText
- Analogies and visualising embeddings
- Bias in embeddings and embeddings for everything
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Recurrence: a network with memory
- Backpropagation through time derived
- An RNN in code
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- LSTM gates derived
- GRU and bidirectional RNNs
- An LSTM text classifier
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Encoder-decoder models
- The bottleneck problem
- Additive attention derived
- Seq2seq with attention in code
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- From sound waves to spectrograms (Fourier transform)
- Speech recognition and text-to-speech pipelines
- Audio AI in code
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
In this lecture:
- Graphs as data
- Message passing derived
- A graph convolutional network in code
The notebook for this lecture is attached as a downloadable resource. Open it in Jupyter or
Google Colab and run it top to bottom; the README lists the packages it needs.
Next-token prediction, smoothing and perplexity are the foundation on which every modern
language model stands. In this assignment you build a character-level n-gram language model from
scratch, with your own counters, and smooth it in two different ways: add-k smoothing and linear
interpolation of all orders up to n. You compare their test perplexity for n from one to five on
a corpus of Indian place names, and let the best models invent new place names. It follows the
lecture on statistical language models: n-grams, smoothing and perplexity, and uses the same
conventions (start padding ^, end symbol $, perplexity in log space).
Learning goals:
- Build n-gram counts with start padding and an end symbol.
- Implement add-k smoothing and linear interpolation, and verify that every smoothed distribution sums to one.
- Compute perplexity safely in log space.
- Decide in advance how to handle characters never seen in training.
- Choose hyperparameters (k and the interpolation weights) on a validation set only, and report test results honestly.
- Explain the bias-variance trade-off in n: longer contexts against sparser counts.
Everything you need is in the attached zip. Read README.md first.
Attention lets a decoder build a fresh summary of the input at every output step. In this
assignment you check, with your own eyes, whether a trained model really uses that freedom
sensibly. You train the sequence-to-sequence model with additive attention from the lecture on
sequence-to-sequence models and the birth of attention on the date normalisation task (for
example 5th Nov 2026 → 2026-11-05), evaluate it honestly on held-out dates, and then read its
attention heat-maps like a scientist: does the decoder look at the day when it writes the day,
and at the month when it writes the month?
Learning goals:
- Train a sequence-to-sequence model with teacher forcing and judge when training has converged.
- Evaluate with real (greedy) decoding using exact match and character accuracy.
- Extract, crop and plot attention weights correctly, without padding positions.
- Interpret an attention heat-map: alignment, reordering, and characters with no source.
- Use wrong predictions to separate alignment errors from generation errors.
- Explain the limits of attention as an explanation of a model's behaviour.
Everything you need is in the attached zip. Read README.md first.
A deep-learning system that classifies 64 x 64 satellite image tiles into ten land-use classes,
explains each decision with a Grad-CAM saliency map, and reports where and why it fails.
Learn artificial intelligence the way top universities teach it: derive every idea, code it, evaluate it, and ship it.
This course takes you from your first line of Python to building, evaluating and deploying modern AI systems. It covers machine learning, deep learning, large language models, retrieval-augmented generation (RAG), AI agents and the Model Context Protocol (MCP). Nothing is treated as a black box. You will see the mathematics behind each model written out step by step, then implement it yourself in a notebook.
What you will learn
Professional Python, NumPy, pandas, SQL and exploratory data analysis
The linear algebra, calculus, probability and information theory behind every model
Classical machine learning: regression, SVMs, trees, ensembles, clustering, forecasting and explainability
Neural networks and deep learning in PyTorch, Keras and JAX, including computer vision and sequence models
Transformers and LLMs: build a GPT from scratch, then learn pretraining, RLHF, DPO, LoRA and reasoning
Generative AI: VAEs, GANs and diffusion models
Search, planning and reinforcement learning, from A* to PPO
Building with LLMs: prompting, RAG, tool calling, agents, MCP and agent security
Evaluation, testing, MLOps, Docker and Google Cloud (Vertex AI, BigQuery, Gemini)
Responsible AI: fairness, privacy, safety, interpretability and law
Who it is for
Serious beginners, developers moving into AI engineering, and students preparing for AI/ML roles. No prior AI or advanced mathematics is assumed.
AI tools assisted in preparing parts of this course’s materials. All content has been designed, reviewed and verified by the instructor.