AI and Machine Learning with Python
Go from a naive baseline in a notebook to a tested, tracked and monitored model: data preparation, classical supervised and unsupervised learning, honest evaluation, PyTorch, foundation model adaptation, reproducible experiments, serving and production monitoring. Modules 1–2 are beginner ML and maths, modules 3–6 are intermediate modelling, and modules 7–11 cover advanced model development, operations and a capstone. You need Python, basic algebra and Git; the statistics and linear algebra are taught as you go. Python from Zero and SQL & PostgreSQL cover the prerequisites, and AI Engineering with Python is the companion path for RAG and LLM applications. Everything runs on a CPU with free, local tools; GPUs and cloud hardware are optional.
What you will be able to do
- Frame an ML problem with a clear target, prediction-time features and a naive baseline
- Prepare versioned data and create defensible, leakage-free splits
- Train and compare classical and neural models with task-appropriate metrics
- Measure uncertainty, analyse errors by slice and document limitations in a model card
- Package a reproducible pipeline behind a batch or API prediction interface
- Define monitoring, retraining and rollback rules for a model in production
Roadmap
Bar length shows each module's share of study time.
- 17h 30m3 topics
Problem framing and the first baseline
Beginner. What ML is and is not, how to define data and labels, and a first reproducible notebook with a baseline. Prerequisites: Python, basic algebra and Git.
Show topicsNot startedClassify a business question as supervised, unsupervised or not an ML problem, and state a baseline and success measure for it.
- Separate AI, ML, deep learning and generative AI
- Compare supervised and unsupervised tasks
- Consider rules and heuristics as baselines
- Pick a practical success measure
Write a data definition that names the unit of observation, target, features, provenance and what is known at prediction time.
- Define the unit of observation
- Choose the target and its label source
- Record data provenance
- Judge label quality
- List what is known at prediction time
Load and profile a small dataset in a pinned Jupyter environment and show a trained model beating a dummy baseline.
- Create a venv and pin packages
- Load and profile a dataset with pandas
- Fix random seeds
- Fit a DummyClassifier baseline
- Compare it with a simple trained model
- 213h4 topics
Useful maths and trustworthy datasets
Beginner. The linear algebra, statistics and optimisation behind models, and preprocessing pipelines that fit on training data only.
Show topicsNot startedCompute dot products, norms and matrix-vector predictions in NumPy and explain each array shape against a feature table.
- Represent rows and features as vectors
- Multiply matrices and check shapes
- Compute dot products and norms
- Use broadcasting safely
- Turn weights and features into predictions
Compute distributions, sample variance, conditional probabilities and correlations on small examples and explain the uncertainty in each.
- Simulate distributions and samples
- Compute mean, variance and standard error
- Work through conditional probability
- Separate correlation from causation
- Bootstrap a confidence interval
Implement gradient descent on a 1D loss, plot train and validation curves, and show how regularisation changes them.
- Define a loss function
- Derive and step along the gradient
- Choose a learning rate
- Add L1 and L2 regularisation
- Plot train and validation loss
Build a ColumnTransformer pipeline that imputes, encodes and scales features while fitting only on the training split.
- Impute missing values
- Encode categorical features
- Scale numeric features
- Handle outliers deliberately
- Fit transforms on training data only
- 310h3 topics
Train supervised models
Intermediate. Regression and classification models, decision thresholds, and tree ensembles compared on the same data.
Show topicsNot startedFit linear, ridge and lasso models, interpret their coefficients and residuals, and compare them by MAE and RMSE.
- Fit ordinary least squares
- Add ridge and lasso penalties
- See why scaling changes coefficients
- Read residual plots
- Compare MAE and RMSE
Train three classifiers, read their predicted probabilities and choose a decision threshold that fits the task.
- Fit logistic regression
- Fit k-nearest neighbours with scaling
- Fit a decision tree
- Read predicted probabilities
- Tune the decision threshold
Compare a single tree, a random forest and gradient boosting on bias, variance, compute cost and interpretability.
- Grow and prune a decision tree
- Bag trees into a random forest
- Boost with HistGradientBoosting
- Compare bias, variance and compute
- Inspect feature importance carefully
Module resources:scikit-learn: supervised learning ↗ - 410h3 topics
Trust the score
Intermediate. Splits that match how the model will be used, leakage checks, classification metrics and a repeatable error-analysis loop.
Show topicsNot startedChoose stratified, grouped or temporal splits, tune with cross-validation and keep a held-out test set free of leakage.
- Pick stratified, grouped or time splits
- Run cross-validation
- Tune hyperparameters with search
- Check for target and train-test leakage
- Touch the test set once
Evaluate an imbalanced classifier with a confusion matrix, PR and ROC curves and calibration, then set a threshold from business costs.
- Read a confusion matrix
- Compute precision, recall and F1
- Compare ROC-AUC and PR-AUC
- Check calibration
- Set a threshold from costs
Run an error-analysis loop that compares slices, bootstraps uncertainty, flags label mistakes and records data limitations.
- Compare metrics by slice
- Bootstrap metric uncertainty
- Inspect likely label errors
- Write an evaluation rubric
- Record data limitations
Module resources:scikit-learn: common pitfalls ↗ - 58h 30m3 topics
Structure and anomalies
Intermediate. Clustering, dimensionality reduction and anomaly scoring, with honest limits on what the scores mean.
Show topicsNot startedCluster scaled data with k-means and DBSCAN, test cluster stability and explain what silhouette scores do not tell you.
- Scale features before clustering
- Fit k-means and choose k
- Fit DBSCAN and tune eps
- Test cluster stability
- Know the limits of cluster scores
Apply PCA and a 2D projection, read explained variance, and test whether reduced features help a downstream model.
- Fit PCA on scaled data
- Read explained variance
- Draw 2D projections carefully
- Test downstream performance
- Avoid over-reading t-SNE plots
Compare z-score thresholds and an isolation forest on synthetic data and estimate the false alert rate each produces.
- Generate synthetic anomalies
- Set statistical thresholds
- Fit an isolation forest
- Estimate false alerts
- Plan for alert feedback loops
Module resources:scikit-learn: unsupervised learning ↗ - 67h 30m2 topics
Time and ranking
Intermediate. Forecasting with rolling backtests and recommendation systems evaluated with ranking metrics.
Show topicsNot startedForecast a seasonal series with lag features, beat a seasonal naive baseline in a rolling backtest and report a forecast interval.
- Spot trend and seasonality
- Build lag and rolling features
- Start from naive and seasonal baselines
- Run a rolling-origin backtest
- Report forecast intervals
Build collaborative and content-based recommenders, handle cold start and compare them with recall@k and NDCG.
- Build a user-item matrix
- Try collaborative filtering
- Try content-based similarity
- Handle cold start
- Measure recall@k and NDCG
Module resources:statsmodels: time series analysis ↗ - 716h4 topics
PyTorch from tensors to training
Advanced. A CPU-friendly PyTorch training loop, generalisation controls, convolutional models with transfer learning, and transformer foundations.
Show topicsNot startedTrain a small network on a CPU with tensors, a DataLoader, a forward pass, a loss, autograd and an optimiser.
- Create and reshape tensors
- Load batches with Dataset and DataLoader
- Define a model with nn.Module
- Compute loss and call backward
- Step the optimiser and evaluate
Use validation curves, regularisation, learning-rate choices, early stopping and checkpoints to produce a repeatable training run.
- Read validation curves
- Add dropout and weight decay
- Tune the learning rate
- Stop early and save checkpoints
- Seed runs for reproducibility
Compare a dense and a convolutional model on an image task, then fine-tune a pretrained model with augmentation and evaluate on distinct data.
- Compare dense and convolutional layers
- Augment training images
- Fine-tune a pretrained backbone
- Evaluate on genuinely distinct data
- Run on CPU or optional GPU
Explain tokenisation, embeddings, attention and a transformer block, and choose between pretrained use, fine-tuning and inference-only use.
- Tokenise text into IDs
- Map tokens to embeddings
- Compute scaled dot-product attention
- Stack transformer blocks
- Compare pretrained use and fine-tuning
Module resources:PyTorch tutorials ↗ - 89h 30m3 topics
Foundation models and adaptation
Advanced. How language models generate text, how to choose an adaptation method, and how to use them responsibly.
Show topicsNot startedRun autoregressive generation with different temperatures and sampling settings and explain why models produce unsupported claims.
- Follow autoregressive decoding
- Compare greedy, top-k and top-p sampling
- Adjust temperature
- Work within the context window
- Explain unsupported claims
Choose between prompting, retrieval, full fine-tuning and LoRA for a task using cost, data rights and evaluation needs, with a small local demo.
- Compare prompting and retrieval
- Know when fine-tuning pays off
- Try parameter-efficient LoRA locally
- Check data rights and licences
- Plan the evaluation first
Assess a model for privacy, fairness, reliability and licensing risks and write a model card with limitations and fallbacks.
- Check privacy and personal data
- Measure fairness across groups
- Verify dataset and model licences
- Write a model card
- Design human review and fallbacks
- 99h 30m3 topics
Reproducible development
Advanced. Track experiments, package and test the full pipeline, and choose between batch and online serving.
Show topicsNot startedLog dataset lineage, split, features, parameters, seeds, metrics and artifacts to MLflow and compare two runs against a baseline.
- Start a local tracking server
- Log parameters, seeds and metrics
- Record dataset and split versions
- Store artifacts with each run
- Compare runs against the baseline
Version the full preprocessing and model pipeline, pin dependencies, load artifacts safely and prove inference parity with pytest.
- Save the whole pipeline, not just the model
- Pin dependencies
- Load artifacts only from trusted sources
- Test inference parity with pytest
- Build a Docker image
Choose batch or online inference for a use case and write the prediction contract, latency budget and staged release plan.
- Compare batch and online inference
- Write a prediction contract
- Set a latency budget
- Plan staged releases
- Hand API work to FastAPI
- 108h 30m3 topics
Production ML health
Advanced. Monitor data, drift and performance, retrain and roll back safely, and govern a model until retirement.
Show topicsNot startedSet monitors for data quality, input drift, concept change, delayed-label performance, service health and cost.
- Check data quality at the input
- Measure feature drift
- Spot concept change
- Track performance with delayed labels
- Watch latency, errors and cost
Define retraining triggers, run shadow or canary checks, promote through a model registry and roll back to the previous version.
- Define retraining triggers
- Run shadow and canary checks
- Promote with registry aliases
- Guard against feedback loops
- Roll back to the last good model
Write the approval evidence, retention rules, audit trail and ownership plan for a model through to its retirement.
- Collect approval evidence
- Set privacy and retention policies
- Keep an audit trail
- Assign ownership
- Plan model retirement
- 1121h3 topics
Build and evaluate a model
Advanced. Build, evaluate and ship a CPU-first tabular model with a baseline, leakage review, model card and monitoring plan.
Show topicsNot startedChoose a licensed tabular dataset, write a model brief, define a versioned split and naive baseline, and complete a leakage review.
- Pick a licensed dataset and record its source
- Write the model brief
- Define and version the split
- Score a naive baseline
- Review for leakage
Compare several estimators with task-appropriate metrics and thresholds, report errors by slice and save a reproducible pipeline.
- Train several candidate estimators
- Build a baseline-vs-candidate table
- Choose metrics and thresholds
- Report slice-specific errors
- Save and track the pipeline
Package batch or API inference with tests and sample predictions, set monitoring thresholds, and publish a model card and rollback plan.
- Package batch or API inference
- Add tests and sample predictions
- Write the inference contract
- Set monitoring thresholds
- Publish the model card and rollback plan