Gradient to Adapter
0% complete
Machine Learning Specialization · 4 courses · 14 weeks

From a line through five points to a language model you fine-tuned yourself.

Written lectures instead of videos, interactive demos you can push around, a quiz every week and a lab with a checkpoint that tells you whether your code is right. Everything runs in this page or in a Python notebook; nothing needs an account.

68written lectures
9interactive demos
14quizzes
14Jupyter labs with solutions
~140 hat six to eight hours a week
Course 1 · 3 weeks

Supervised Learning: Regression and Classification

The model, the cost, the gradient. Linear and logistic regression built from NumPy up, then regularized.

  • Gradient descent, with a demo you can break
  • Feature scaling and polynomial features
  • Log loss, decision boundaries, overfitting
Open course →
Course 2 · 3 weeks

Neural Networks and Applied Machine Learning

Forward and backward propagation, softmax, Adam, then the discipline of evaluating a model and the tree models that still win on tables.

  • A network trained live in your browser
  • Bias, variance, learning curves, error analysis
  • Decision trees, random forests, boosting
Open course →
Course 3 · 3 weeks

Unsupervised Learning, Recommenders and Reinforcement Learning

Finding structure without labels, learning what people will like, and learning from reward.

  • K-means and anomaly detection
  • Collaborative and content-based filtering
  • Q-learning on a grid you can watch train
Open course →
Course 4 · 5 weeks

Fine-Tuning Language Models

Take a pretrained open model and make it yours: data, LoRA and QLoRA, the training run, preference alignment, evaluation and serving.

  • A LoRA memory calculator and LoRA from scratch
  • SFT, DPO, a tokenizer and a tiny GPT built from scratch
  • Quantization, KV cache, serving; capstone on your own task
Open course →

How the courses work

Lectures are written, in two layersEach lecture is a 6–12 minute read: intuition, the formula to remember, the code. Under it, a Deep dive expands into the full derivation, a worked example you can follow with a calculator, and the mistakes people actually make.
Demos replace the chalkboardNine small simulations run in this page: push the learning rate too high, overfit a polynomial, train a neural network, watch k-means converge, train an agent on a grid.
Quizzes check understandingFive questions per week with explanations for every answer. Scores stay in this browser.
Labs are Jupyter notebooksEach lab is a notebook with TODO cells and a self-check after every step, then a graded practice set of harder exercises and a mini-project. A checkpoint on this page asks for one number your code must produce. The solutions notebooks are fully executed, with outputs and plots.
PrerequisitesPython at the level of loops, functions and lists; high-school algebra. Linear algebra and calculus are introduced where needed.
ToolsPython 3, NumPy, scikit-learn, PyTorch. For Course 4, the Hugging Face stack and a free Colab GPU.

Schedule

One week per row at six to eight hours. Every week ends with a quiz and a lab; the last week of each course ends with a project.

WeekCourseTopicYou finish with
11Linear regression and gradient descentGradient descent written from scratch, fitting a price line
21Regression with many featuresVectorized regression with z-score scaling and polynomial features
31Classification and regularizationRegularized logistic regression with a plotted decision boundary
42Neural networksA two-layer network in NumPy, then the same in PyTorch
52Training networksA ten-class digit classifier with softmax and Adam
62Applying ML; decision treesA bias/variance diagnosis and a tree built from information gain
73Clustering, anomaly detection, PCAK-means image compression and a Gaussian anomaly detector
83Recommender systemsCollaborative filtering trained in PyTorch
93Reinforcement learningTabular Q-learning that solves a grid world
104From pretrained to adaptedAn instruction dataset rendered through the model's chat template
114Parameter-efficient fine-tuningA complete LoRA run with TRL and a read loss curve
124Alignment, evaluation, deploymentA DPO run, an evaluation against the base model, a GGUF served locally
134Tokenizer and transformer from scratchBPE, multi-head attention and a tiny GPT trained on CPU, with sampling
144Quantization, inference and servingint8 / 4-bit quantization, a KV cache verified against full recompute, serving maths

The notebooks

Twelve labs in notebooks/, each with a student version (TODO cells, self-checks) and an executed solutions version in notebooks/solutions/. Small datasets ship in notebooks/data/; everything in Courses 1–3 runs offline on a laptop. Course 4's real training cells are guarded by a RUN_TRAINING flag for a GPU machine.

LabNotebookBuildsNeeds
C1 · W1c1w1_linear_regression Runs in browsercost, gradients with a numerical check, gradient descent, convergence test, 100-house fit vs closed formNumPy
C1 · W2c1w2_multiple_features Runs in browservectorized regression, z-score scaling, polynomial features, scikit-learn comparisonNumPy, scikit-learn
C1 · W3c1w3_logistic_regression Runs in browsersigmoid, log loss, boundary plot, L2 regularization, λ sweep on breast cancer dataNumPy, scikit-learn
C2 · W1c2w1_neural_network PyTorch · localNumPy forward prop, parameter counting, PyTorch training, cross-framework check, custom LinearPyTorch
C2 · W2c2w2_multiclass_training PyTorch · localsoftmax, early stopping loop, confusion matrix, experiments, backprop by hand with gradient checkPyTorch
C2 · W3c2w3_trees_and_diagnostics PyTorch · localentropy and information gain, recursive tree, learning curve, precision/recall, forest vs XGBoostPyTorch, XGBoost
C3 · W1c3w1_clustering_anomaly_pca Runs in browserk-means in two functions, image compression, Gaussian anomaly detector with ε selection, PCA via SVDNumPy, scikit-learn
C3 · W2c3w2_recommenders PyTorch · localmean normalization, collaborative-filtering loss, Adam training, new-user recommendations, item similarityPyTorch
C3 · W3c3w3_q_learning Runs in browsergrid world, tabular Q-learning, policy rendering, stochastic world with a trap, minimal DQNNumPy (+PyTorch)
C4 · W1c4w1_dataset_and_template Runs in browsermessages format, filtering and dedupe, split, gold set and decontamination, ChatML renderer, token lengthspandas (+transformers)
C4 · W2c4w2_lora_and_sft PyTorch · localLoRA layer from scratch with merge, parameter/memory calculator, checkpoint selection from a log, real TRL runPyTorch (+TRL on GPU)
C4 · W3c4w3_dpo_eval_export PyTorch · localDPO loss, structured-output metrics, position-swapped pairwise judge, regression table, real DPO and GGUF exportPyTorch (+TRL on GPU)
C4 · W4c4w4_transformer_from_scratch PyTorch · localBPE tokenizer, causal attention checked against PyTorch, transformer block, tiny GPT, temperature/top-k/top-p samplingPyTorch
C4 · W5c4w5_quantization_inference PyTorch · localabsmax and zero-point int8, block-wise 4-bit, quantized model accuracy, KV cache, memory calculatorPyTorch

Labs marked Runs in browser execute right on this page: open one, press Start Python, then edit and run cells (Shift+Enter). Python is loaded once (about 30–40 MB, cached afterwards) and your edits are kept in this browser. Labs marked PyTorch need a local Python or Colab: download the notebook and the data files below into a folder named data/ next to it.

Your progress

Tick each lecture, quiz and lab as you finish it. Ticks and quiz scores stay in this browser only.

Course 1 · Supervised learning0 / 0
Course 2 · Neural networks0 / 0
Course 3 · Unsupervised & RL0 / 0
Course 4 · Fine-tuning0 / 0