Learn Machine Learning
Learn machine learning: the mathematics underneath it, the main families of models, how to train and evaluate them honestly, and enough practice to know when a result is real.
This plan takes you from complete mathematical and programming fundamentals to an in-depth understanding of statistical learning theory, core model architectures, deep learning, and rigorous experimental validation. Following your theory-first preference, each phase establishes the underlying mathematical proofs and conceptual models before building implementations from scratch in Python and applying them to benchmark datasets. Over approximately 45 to 50 weeks at 10 hours per week, you will progress through 10 distinct phases covering linear algebra, calculus, classical algorithms, probabilistic models, neural networks, and diagnostic validation. By the end, you will be able to derive, implement, train, and mathematically validate machine learning systems without relying on blind heuristics.
By the end: You will be able to formulate machine learning problems mathematically, implement classical and deep learning algorithms from scratch in Python, and execute rigorous, leak-free validation protocols that distinguish true predictive signals from data artifacts.
This is the map — make this roadmap yours
It shows what this journey generally looks like. Tell Kaidoro your version of the goal and it builds the plan around where you are actually starting, what to do first, the hours you really have, and what you have already finished.
Mathematical Foundations — Linear Algebra & Multivariate Calculus
Establish the foundational mathematics of machine learning: vector spaces, matrix factorizations, gradients, and multivariate optimization.
- Study vector spaces, matrix operations, and eigenvalues~5hLearn2 resources
Machine learning represents data points as high-dimensional vectors and linear transformations as matrices.
You'll learn
- Vector norm — mathematical measure of vector length and magnitude
- Dot product — algebraic operation returning the cosine similarity scaled by vector magnitudes
- Eigendecomposition — factorization of a matrix into canonical eigenvalues and eigenvectors
- Singular Value Decomposition (SVD) — matrix factorization generalizing eigendecomposition to non-square matrices
Work through vector projections, matrix multiplication mechanics, determinants, matrix rank, and eigendecomposition. These linear algebra principles form the structural backbone of dimensionality reduction and linear model parameter spaces.
Done when: you can compute matrix inverses, determinants, and eigendecompositions by hand on 2x2 and 3x3 matrices and explain the geometric meaning of eigenvalues.
How to work through it
- Review vector arithmetic, dot products, vector norms, and orthogonality
- Study matrix transformations, rank, null space, and determinants
- Calculate eigenvalues and eigenvectors for 2x2 and 3x3 matrices
- Work through the geometric intuition of singular value decomposition (SVD)
- Derive multivariate gradients, Jacobians, and Hessians~4hLearn1 resource
Training machine learning models almost always boils down to optimizing an objective function with multivariate calculus.
You'll learn
- Gradient vector — vector of partial derivatives pointing in the direction of steepest ascent
- Jacobian matrix — matrix of all first-order partial derivatives of a vector-valued function
- Hessian matrix — square matrix of second-order partial derivatives describing local curvature
- Convexity — property where any local minimum is guaranteed to be a global minimum
Study multivariate differential calculus, focusing on partial derivatives, the chain rule in multiple dimensions, gradients, Jacobian matrices, and Hessian matrices. These tools are the fundamental engine of gradient-based optimization.
Done when: you can analytically compute the gradient vector and Hessian matrix for quadratic multivariate functions.
How to work through it
- Review single-variable derivatives and rules of differentiation
- Compute partial derivatives for multivariate scalar fields
- Derive the multi-variable chain rule and formulate gradient vectors
- Construct Jacobian and Hessian matrices and analyze second-order convexity conditions
- Study unconstrained numerical optimization algorithms~4hLearn
Understanding optimization theory ensures you know why loss functions fail to converge and how learning rates govern parameter updates.
You'll learn
- Learning rate — scalar step size used to update parameters along the negative gradient
- Newton-Raphson method — second-order optimization using curvature information from the inverse Hessian
- Stochastic Gradient Descent (SGD) — gradient descent approximating the gradient over a single sample or mini-batch
Analyze mathematical optimization routines including standard gradient descent, stochastic gradient descent (SGD), momentum, and Newton-Raphson methods. Examine learning rates, divergence conditions, and condition numbers.
Done when: you can write down the parameter update equations for gradient descent and Newton's method from memory and state their convergence rates.
How to work through it
- Derive first-order gradient descent parameter updates from Taylor approximations
- Analyze the impact of learning rate magnitudes on convergence
- Study second-order Newton-Raphson optimization and Hessian inversion cost
- Contrast batch gradient descent with stochastic and mini-batch sampling
- Write a pure Python vector and matrix algebra engine~5hBuild
Translating linear algebra equations into functional code solidifies abstract mathematical definitions into tangible data structures.
You'll learn
- Gaussian elimination — algorithm for solving systems of linear equations via row reduction
- Finite differences — numerical approximation of derivatives using small delta steps
Implement a pure Python class hierarchy for Vectors and Matrices without external math libraries. Include matrix multiplication, transposition, determinants, Gaussian elimination, and numerical gradient calculation.
Done when: your pure Python matrix engine successfully computes matrix multiplication, solves a system of 3 linear equations via Gaussian elimination, and matches analytical gradients to within 1e-5 numerical error.
How to work through it
- Create a Matrix class supporting addition, scalar multiplication, and dot products
- Implement matrix transposition and row reduction algorithms
- Implement Gaussian elimination to solve systems of linear equations Ax = b
- Write a numerical gradient check function using finite differences
Scientific Computing & Probability Theory
Learn vectorized computing in NumPy and master probability distributions, Bayes' Theorem, and Maximum Likelihood Estimation.
- Study probability spaces, random variables, and expectation~4hLearn1 resource
Machine learning models quantify uncertainty using probability theory.
You'll learn
- Bayes' Theorem — mathematical formula for determining conditional probability based on prior knowledge
- Probability Density Function (PDF) — function specifying probability per unit length of a continuous random variable
- Covariance — statistical measure of the joint variability of two random variables
Establish probability theory fundamentals: joint, marginal, and conditional probabilities, Bayes' rule, probability density functions, expectation, variance, and covariance.
Done when: you can solve Bayesian probability updating problems on paper and compute expected values and covariance matrices analytically.
How to work through it
- Define probability axioms, sample spaces, and independence
- Derive and apply Bayes' Theorem for conditional hypothesis testing
- Study discrete distributions (Bernoulli, Binomial) and continuous distributions (Gaussian, Uniform)
- Derive mathematical definitions of variance, standard deviation, and covariance
- Derive Maximum Likelihood Estimation (MLE) and MAP~4hLearn
Loss functions in machine learning (like Mean Squared Error and Cross-Entropy) directly emerge from maximizing likelihood under probabilistic assumptions.
You'll learn
- Maximum Likelihood Estimation (MLE) — method of estimating parameters of an assumed probability distribution given observed data
- Log-likelihood — logarithm of the likelihood function used to transform products of probabilities into sums
- Maximum A Posteriori (MAP) — Bayesian estimation method incorporating a prior probability distribution over parameters
Explore the statistical foundations of parameter estimation. Derive Maximum Likelihood Estimation (MLE) and Maximum A Posteriori (MAP) estimation across Gaussian and Bernoulli likelihoods.
Done when: you have derived the analytical MLE closed-form estimator for the mean and variance of a univariate Gaussian distribution on paper.
How to work through it
- Formulate likelihood and log-likelihood functions for independent and identically distributed (i.i.d.) data
- Derive the analytical MLE for the Gaussian distribution parameter set
- Derive the analytical MLE for the Bernoulli parameter set
- Contrast MLE with Maximum A Posteriori (MAP) estimation incorporating prior distributions
- Learn NumPy vectorization, broadcasting, and indexing~4hLearn1 resource
All production and scientific machine learning libraries rely on vectorized array operations for performance.
You'll learn
- Broadcasting — NumPy mechanism allowing arithmetic operations on arrays of different shapes
- Vectorization — replacing explicit scalar loops with batch operations executed in compiled C
- ndarray — core n-dimensional array data structure in NumPy with contiguous memory allocation
Learn efficient scientific computing in Python using NumPy. Master contiguous memory layouts, multi-dimensional slicing, axis-based operations, broadcasting rules, and vectorization techniques that avoid Python loops.
Done when: you can rewrite nested Python array loops into vectorized NumPy operations that execute over 50x faster on arrays of 100,000 elements.
How to work through it
- Create and manipulate ndarrays with explicit data types (dtypes)
- Master NumPy broadcasting rules across mismatched array dimensions
- Apply fancy boolean indexing and multi-axis reductions (sum, mean, max)
- Benchmark vectorized matrix routines against naive nested Python loops
- Build a probabilistic simulation and MLE solver in NumPy~4hBuild
Implementing estimation routines in NumPy bridges probability theory with scientific programming.
You'll learn
- Synthetic data generation — creating controlled datasets with known ground truth parameters
- Log-likelihood surface — multi-dimensional geometric surface representing parameter likelihood
Write a vectorized NumPy program that simulates noisy data from mixed Gaussian distributions, computes empirical summary statistics, and solves for optimal distribution parameters using numerical and analytical MLE.
Done when: your script estimates distribution parameters from 10,000 synthetic samples to within 1% error and visualizes the log-likelihood surface alongside the analytical maximum.
How to work through it
- Generate synthetic data drawn from univariate and bivariate Gaussian distributions
- Implement the vectorized log-likelihood function for Gaussian and Bernoulli models
- Find the parameter estimates analytically and via numerical optimization using scipy.optimize
- Plot the log-likelihood optimization path using Matplotlib
Linear Models from First Principles
Derive, implement, and analyze Ordinary Least Squares, Ridge, Lasso, and Logistic Regression without using high-level machine learning frameworks.
- Derive Ordinary Least Squares (OLS) closed-form and gradient updates~4hLearn
Linear regression is the foundational baseline for supervised learning and demonstrates the connection between calculus, linear algebra, and statistical loss functions.
You'll learn
- Normal Equation — closed-form algebraic solution for the weights in linear regression
- Mean Squared Error (MSE) — loss function measuring the average squared difference between predictions and targets
- Residuals — difference between observed target values and predicted model values
Study linear regression under the assumption of additive Gaussian noise. Derive the normal equations (closed-form matrix solution) and the Mean Squared Error gradient update rule.
Done when: you can mathematically derive the normal equation (X^T X)^(-1) X^T y from the matrix derivative of the residual sum of squares.
How to work through it
- Set up the matrix formulation of linear regression Y = Xw + epsilon
- Derive the residual sum of squares (RSS) loss function in matrix notation
- Differentiate the loss with respect to weight vector w and solve for normal equations
- Derive the step-by-step batch gradient descent update rule for linear regression
- Study regularization theory: Ridge (L2) and Lasso (L1)~4hLearn
Regularization is the mathematical mechanism for controlling model complexity and preventing overfitting.
You'll learn
- Ridge Regression (L2) — regularization adding a squared magnitude penalty to the loss function
- Lasso Regression (L1) — regularization adding an absolute magnitude penalty encouraging sparsity
- Multicollinearity — condition where independent variables in a regression model are highly correlated
Examine the mathematical mechanics of regularization. Understand how L2 (Ridge) acts as a Gaussian prior penalizing large weights and how L1 (Lasso) acts as a Laplace prior inducing parameter sparsity.
Done when: you can explain geometrically using contour plots why L1 regularization produces exact zero coefficients while L2 shrinks weights asymptotically.
How to work through it
- Analyze ill-conditioned matrix inversion and multicollinearity in unregularized OLS
- Derive the Ridge regression closed-form solution (X^T X + lambda I)^(-1) X^T y
- Examine L1 sub-gradient optimization and coordinate descent for Lasso
- Compare L1 and L2 penalty constraints geometrically using level curves
- Derive Logistic Regression and Binary Cross-Entropy~4hLearn
Logistic regression establishes the mathematical framework for probabilistic classification.
You'll learn
- Sigmoid function — S-shaped activation function mapping real values into probabilities between 0 and 1
- Binary Cross-Entropy — loss function measuring divergence between two probability distributions for binary outcomes
- Decision boundary — hyper-surface separating different predicted class regions in feature space
Analyze binary classification via the logistic sigmoid function. Derive the odds ratio, logit link function, and the Binary Cross-Entropy loss via Maximum Likelihood Estimation.
Done when: you can derive the gradient of binary cross-entropy loss with respect to model weights and prove it matches the structural form of the linear regression gradient.
How to work through it
- Define the logistic sigmoid function and its mathematical derivative
- Formulate binary classification likelihood assuming a Bernoulli output distribution
- Derive the Negative Log-Likelihood (Binary Cross-Entropy) loss function
- Compute the analytical gradient of cross-entropy with respect to the weight vector
- Build a from-scratch linear models library in NumPy~5hBuild
Writing models completely from scratch guarantees deep algorithmic comprehension and prepares you to debug production models.
You'll learn
- Estimator API — design pattern standardizing model fitting, transformation, and prediction interfaces
- Gradient step verification — checking code correctness by comparing analytical and numerical gradients
Create an object-oriented Python module from scratch in NumPy containing LinearRegression (with OLS normal equations and SGD solvers), RidgeRegression, and LogisticRegression.
Done when: your scratch models match the weights and predictions of scikit-learn's implementations to within 1e-4 tolerance across synthetic regression and classification datasets.
How to work through it
- Implement a base Estimator class with fit, predict, and score methods
- Implement LinearRegression with both analytical normal equations and SGD optimizers
- Implement RidgeRegression with regularized closed-form inversion
- Implement LogisticRegression with vectorized gradient descent and binary threshold prediction
- Write unit tests validating outputs against scikit-learn baselines
Statistical Learning Theory & Validation Rigor
Learn the theory of generalization: bias-variance tradeoff, cross-validation, data leakage vectors, and evaluation metrics.
- Deconstruct the Bias-Variance Tradeoff mathematically~4hLearn1 resource
The bias-variance tradeoff is the foundational theoretical framework for diagnosing model behavior and selecting appropriate complexity.
You'll learn
- Bias — error introduced by approximating a real-world problem with an overly simplistic model
- Variance — error introduced by model sensitivity to small fluctuations in training data
- Irreducible error — intrinsic noise in the data generation process that cannot be eliminated by any model
Derive the mathematical decomposition of Mean Squared Error into intrinsic noise, squared bias, and variance. Study underfitting, overfitting, and structural risk minimization.
Done when: you can write down the step-by-step mathematical proof decomposing expected prediction error into irreducible error, bias squared, and variance.
How to work through it
- Write the mathematical definition of expected test error for a noisy target y = f(x) + epsilon
- Expand and decompose the expectation into irreducible variance, model bias squared, and model variance
- Map underfitting and overfitting states to high-bias and high-variance regimes
- Plot simulated learning curves illustrating training error vs. validation error as sample size increases
- Study cross-validation schemes and data leakage vectors~4hLearn
Flawed validation protocols create deceptively high test scores that collapse completely in production or on new data.
You'll learn
- Data leakage — unintended transfer of information from the test set or future data into the training process
- Stratified K-Fold — cross-validation partitioning that preserves identical class label proportions across folds
- Target leakage — inclusion of features that duplicate or reveal the target variable during training
Analyze cross-validation techniques: k-fold, stratified k-fold, and time-series rolling splits. Identify subtle data leakage vectors including pre-split normalization, target leakage, and temporal lookahead.
Done when: you can list 5 distinct real-world data leakage scenarios and describe the architectural validation pipeline required to prevent each one.
How to work through it
- Analyze k-fold, stratified k-fold, and leave-one-out cross-validation mechanics
- Study out-of-fold estimation and cross-validated score variance
- Identify pre-processing data leakage (scaling, imputing, feature selecting before splitting)
- Analyze temporal and group leakage in sequential or clustered datasets
- Analyze classification and regression evaluation metrics~4hLearn
Choosing the wrong metric obscures model failure modes and leads to false conclusions about algorithmic superiority.
You'll learn
- Confusion Matrix — table visualizing performance of a classification algorithm across true and false predictions
- ROC-AUC — metric measuring discrimination ability across all classification probability thresholds
- Precision-Recall curve — metric curve evaluating classification performance under severe class imbalance
Master evaluation metrics beyond simple accuracy. Study precision, recall, F1-score, ROC curves, Area Under the Curve (AUC), PR curves, log-loss, Mean Absolute Error (MAE), and R-squared.
Done when: you can explain why accuracy is misleading on an imbalanced dataset (e.g. 99:1 ratio) and construct a precision-recall curve from raw predicted probabilities.
How to work through it
- Construct a confusion matrix and derive True Positive Rate, False Positive Rate, Precision, and Recall
- Derive the harmonic mean formula for the F1-score and its generalized F-beta formulation
- Trace the step-by-step algorithm for calculating ROC curves and ROC-AUC scores
- Compare Mean Absolute Error (L1 loss) and Mean Squared Error (L2 loss) sensitivity to outliers
- Build a leak-free cross-validation and metric evaluation harness~4hBuild
Building a standardized validation engine ensures all subsequent experimental results are statistically honest.
You'll learn
- Scikit-learn Pipeline — utility assembling several steps that can be cross-validated together while setting different parameters
- Bootstrap confidence interval — non-parametric method of estimating metric uncertainty via repeated resampling with replacement
Implement a Python validation harness that performs k-fold cross-validation with scikit-learn Pipeline objects, prevents pre-processing leakage, computes metric confidence intervals, and outputs diagnostic plots.
Done when: your harness runs a 5-fold stratified cross-validation on an imbalanced dataset without leakage, outputs ROC and PR curves, and reports metrics with 95% bootstrap confidence intervals.
How to work through it
- Construct a scikit-learn Pipeline encapsulating feature scalers, encoders, and classifiers
- Implement a stratified k-fold validation loop executing strictly within the pipeline
- Calculate bootstrap confidence intervals for accuracy, F1, and AUC metrics
- Plot cross-validated ROC curves with variance bands
Non-Parametric & Tree-Based Models
Explore non-parametric methods, decision trees, and ensemble algorithms: Random Forests, Bagging, and Gradient Boosting.
- Study k-Nearest Neighbors (k-NN) and the Curse of Dimensionality~3hLearn
k-NN represents the purest form of non-parametric instance-based learning.
You'll learn
- Curse of Dimensionality — phenomenon where data becomes sparse in high-dimensional space, degrading distance metrics
- k-d tree — space-partitioning data structure for organizing points in a k-dimensional space
Analyze distance-based classification and regression using k-NN. Study Euclidean, Manhattan, and Minkowski distance metrics alongside the geometric curse of dimensionality in high-dimensional spaces.
Done when: you can mathematically explain why distance metrics become uninformative as the number of dimensions approaches infinity.
How to work through it
- Study distance metrics: Euclidean (L2), Manhattan (L1), and Cosine distance
- Derive the mathematical geometry of hyper-spheres inscribed in hyper-cubes in high dimensions
- Analyze the computational complexity of brute-force nearest-neighbor searches versus k-d trees
- Evaluate the sensitivity of distance-based models to unscaled feature variables
- Derive Decision Tree splitting criteria (Gini, Entropy, Variance)~4hLearn
Decision trees form the fundamental building blocks of all modern tree-based ensemble algorithms.
You'll learn
- Gini Impurity — measure of how often a randomly chosen element from the set would be incorrectly labeled
- Shannon Entropy — quantitative measure of the average uncertainty or information content in a random variable
- Information Gain — reduction in entropy achieved by partitioning data according to a specific feature
Study recursive binary splitting in decision trees. Derive Information Gain, Shannon Entropy, Gini Impurity for classification, and Variance Reduction for regression.
Done when: you can compute Gini impurity and Information Gain splits by hand for a toy tabular dataset and determine the optimal split feature and threshold.
How to work through it
- Derive Shannon Entropy H(S) = - sum p_i log2(p_i) and Information Gain formulas
- Derive Gini Impurity G(S) = 1 - sum (p_i)^2 and contrast with entropy
- Understand greedy recursive splitting algorithms (CART and ID3)
- Analyze stopping criteria, minimum leaf samples, maximum depth, and cost-complexity pruning
- Study Ensemble Theory: Bagging, Random Forests, and Gradient Boosting~5hLearn1 resource
Ensemble tree models (Random Forest, XGBoost, LightGBM) represent state-of-the-art architectures for tabular predictive modeling.
You'll learn
- Bagging (Bootstrap Aggregation) — ensemble technique training multiple base models on bootstrap subsets to reduce variance
- Random Forest — ensemble of decision trees utilizing random feature subsets to decorrelate individual trees
- Gradient Boosting — sequential ensemble technique fitting new base learners to the pseudo-residuals of previous models
Examine ensemble learning principles. Study variance reduction via Bootstrap Aggregation (Bagging), feature subspace sampling in Random Forests, and sequential residual reduction via Gradient Boosting (GBM).
Done when: you can formulate the gradient boosting update equation as gradient descent in function space.
How to work through it
- Analyze variance reduction achieved by averaging independent estimators
- Study Random Forest decorrelation via random feature subset selection at split points
- Derive AdaBoost weight updates and exponential loss optimization
- Derive Gradient Boosting parameter updates using pseudo-residuals as target gradients
- Build a CART Decision Tree and Gradient Boosted Tree in NumPy~6hBuild
Implementing trees and boosting loops from scratch makes the sequential optimization process completely transparent.
You'll learn
- Recursive partitioning — algorithmic technique of continuously splitting data into smaller subsets
- Pseudo-residuals — negative gradient of the loss function with respect to current ensemble predictions
Implement a pure Python/NumPy DecisionTreeRegressor from scratch with recursive splitting, then use it as the base learner to construct a custom GradientBoostedRegressor.
Done when: your scratch GradientBoostedRegressor fits a non-linear continuous 1D target function, achieves an R^2 score > 0.90, and matches scikit-learn's GradientBoostingRegressor predictions within 5% error.
How to work through it
- Implement a Node class storing split feature index, threshold value, and leaf predictions
- Implement recursive best-split search minimizing mean squared error
- Build a DecisionTreeRegressor class with configurable max_depth and min_samples_split
- Build a GradientBoostedRegressor that iteratively fits regression trees to residual errors
- Train the scratch boosted model on a non-linear sinusoidal function
Support Vector Machines & Kernel Methods
Understand maximum margin classifiers, convex quadratic optimization, duality theory, and non-linear kernel transformations.
- Derive Maximum Margin Classifiers and SVM Primal Formulation~4hLearn1 resource
Support Vector Machines provide a rigorous geometric approach to linear classification rooted in convex optimization.
You'll learn
- Support Vectors — training data points lying on or inside the margin boundary that uniquely define the decision boundary
- Slack variable — penalty variable permitting margin violations in non-linearly separable datasets
- Margin — perpendicular distance between the decision hyperplane and the closest data points
Study the geometric formulation of hyperplanes in separable data spaces. Derive the mathematical optimization problem of maximizing the margin 2 / ||w|| subject to classification constraints.
Done when: you can write the primal constrained optimization problem for hard-margin and soft-margin SVMs using slack variables.
How to work through it
- Define hyperplane geometry and geometric distance from a data point to a hyperplane
- Formulate the hard-margin SVM optimization problem as a quadratic program
- Introduce slack variables (xi) to derive the soft-margin SVM with penalty parameter C
- Analyze the role of the C hyperparameter in controlling margin width vs. training errors
- Derive the SVM Dual Formulation and the Kernel Trick~4hLearn
The kernel trick is a powerful mathematical concept enabling linear algorithms to operate in non-linear feature spaces efficiently.
You'll learn
- Lagrangian Duality — mathematical transformation converting a constrained primal problem into an equivalent dual optimization problem
- KKT Conditions — first-order necessary conditions for a solution in non-linear programming to be optimal
- Kernel Trick — method of computing dot products in high-dimensional feature spaces implicitly using kernel functions
- Radial Basis Function (RBF) — kernel function measuring similarity based on squared Euclidean distance
Apply Lagrange multipliers and Karush-Kuhn-Tucker (KKT) conditions to derive the SVM dual optimization problem. Study Mercer's theorem and kernel functions (Linear, Polynomial, Radial Basis Function).
Done when: you can formulate the dual SVM problem and demonstrate how the kernel trick computes inner products in infinite-dimensional Hilbert space without explicit feature mapping.
How to work through it
- Formulate the Lagrangian function for the primal SVM optimization problem
- Apply KKT conditions and differentiate with respect to primal variables (w, b)
- Substitute optimal conditions back into the Lagrangian to construct the dual objective function
- Analyze Mercer's conditions and mathematical formulas for RBF and Polynomial kernels
- Implement a Soft-Margin SVM with Quadratic Programming in Python~5hBuild
Directly implementing the dual quadratic program confirms your grasp of Lagrange multipliers and kernel transformations.
You'll learn
- Gram matrix — matrix of all possible pairwise inner products between sample vectors in feature space
- Quadratic Programming — optimization method for minimizing a quadratic objective function subject to linear constraints
Implement a dual soft-margin Support Vector Machine using Python and the
cvxoptquadratic programming solver. Support both linear and RBF kernels.Done when: your custom SVM identifies correct support vector indices and produces accurate non-linear decision boundaries on the two-moons benchmark dataset.
How to work through it
- Set up the Gram matrix using vectorized linear and RBF kernel functions
- Formulate the quadratic programming matrices (P, q, G, h, A, b) required by cvxopt
- Solve for Lagrange multipliers (alpha) and extract non-zero support vectors
- Compute the intercept parameter b and implement the decision function for new points
- Visualize the decision boundary and highlighted support vectors using Matplotlib
Unsupervised Learning & Dimensionality Reduction
Study clustering algorithms, Principal Component Analysis, and generative probabilistic clustering using Gaussian Mixture Models.
- Derive Principal Component Analysis (PCA) via SVD and Covariance~4hLearn
PCA is the primary baseline for linear dimensionality reduction, compression, and feature decorrelation.
You'll learn
- Principal Component Analysis (PCA) — orthogonal linear transformation transforming data into linearly uncorrelated variables
- Explained Variance Ratio — proportion of the dataset's total variance accounted for by each principal component
- Reconstruction error — squared difference between original high-dimensional data and its low-rank approximation
Analyze PCA from two mathematical perspectives: maximizing variance of projected data and minimizing reconstruction error. Derive the connection between the covariance matrix eigenvectors and the Singular Value Decomposition (SVD).
Done when: you can mathematically prove that the first principal component is the eigenvector of the empirical covariance matrix corresponding to its largest eigenvalue.
How to work through it
- Formulate the variance maximization objective for a 1D linear projection
- Apply Lagrange multipliers with unit vector constraint ||u|| = 1 to derive the eigenvector equation
- Relate the data matrix SVD (X = U Sigma V^T) directly to the covariance matrix decomposition
- Calculate the proportion of explained variance from singular values
- Study Clustering: k-Means and Hierarchical Clustering~3hLearn
Clustering methods reveal latent geometric structure in unlabelled data distributions.
You'll learn
- k-Means — unsupervised clustering algorithm partitioning n observations into k clusters
- k-means++ — initialization algorithm choosing initial seeds with probability proportional to squared distance from nearest existing center
- Silhouette Score — metric evaluating clustering quality by measuring cohesion within clusters versus separation from other clusters
Analyze centroid-based and connectivity-based clustering. Study the k-Means objective function (inertia), Lloyd's optimization algorithm, k-means++ initialization, and dendrogram construction in hierarchical clustering.
Done when: you can prove that Lloyd's algorithm for k-Means is guaranteed to monotonically decrease the sum of squared distances at every iteration.
How to work through it
- Formulate the k-Means objective function (Within-Cluster Sum of Squares)
- Derive the two-step iterative optimization: cluster assignment step and centroid update step
- Analyze k-means++ probabilistic distance-weighted initialization
- Study agglomerative hierarchical clustering distance link criteria (single, complete, average, Ward)
- Derive Gaussian Mixture Models (GMM) and Expectation-Maximization~4hLearn1 resource
The Expectation-Maximization algorithm is an essential theoretical pillar of probabilistic machine learning and latent variable estimation.
You'll learn
- Gaussian Mixture Model (GMM) — probabilistic model assuming all data points are generated from a mixture of finite Gaussian distributions
- Expectation-Maximization (EM) — iterative optimization algorithm for finding maximum likelihood estimates in latent variable models
- Responsibility — posterior probability that a specific mixture component generated a given observation
Study probabilistic soft clustering with Gaussian Mixture Models. Derive the Expectation-Maximization (EM) algorithm for latent variable models, including the E-step (posterior probabilities) and M-step (parameter updates).
Done when: you can mathematically derive the E-step and M-step update formulas for a mixture of K Gaussians from the complete-data log-likelihood.
How to work through it
- Define the generative probability model for Gaussian mixtures with latent indicator variables
- Analyze why standard MLE fails on mixture distributions due to sums inside the logarithm
- Derive the Expectation step (calculating responsibilities / posterior class probabilities)
- Derive the Maximization step (updating means, covariances, and mixing coefficients)
- Build PCA and an EM Gaussian Mixture Model in NumPy~5hBuild
Coding PCA and EM from scratch cements your understanding of linear algebraic transformations and latent variable models.
You'll learn
- Latent variable — variable that is not directly observed but inferred through mathematical modeling
- Log-likelihood convergence — monitoring the increase in log-likelihood across EM iterations to detect convergence
Implement PCA via SVD and a complete Gaussian Mixture Model fitted via the Expectation-Maximization algorithm from scratch in Python/NumPy.
Done when: your scratch PCA reproduces scikit-learn projection vectors exactly, and your scratch GMM successfully recovers the true means, covariances, and cluster assignments on a synthetic 3-component Gaussian dataset.
How to work through it
- Implement PCA class calculating mean centering, SVD decomposition, and transform/inverse_transform methods
- Implement GMM class with randomized/k-means++ initialization of means and covariances
- Write the vectorized E-step computing Gaussian densities and responsibilities
- Write the vectorized M-step updating parameters and track log-likelihood convergence
- Plot cluster confidence ellipses for fitted Gaussian components
Neural Networks & Deep Learning Foundations
Understand artificial neural networks, automatic differentiation, computational graphs, and the backpropagation algorithm.
- Study Multi-Layer Perceptrons and Activation Functions~4hLearn1 resource
Neural networks extend linear models to learn complex non-linear representations automatically.
You'll learn
- Universal Approximation Theorem — theorem stating that a feedforward network with a single hidden layer can approximate any continuous function
- ReLU (Rectified Linear Unit) — activation function defined as f(x) = max(0, x)
- Softmax — function that normalizes a vector of K real numbers into a probability distribution over K classes
Analyze feedforward neural networks, universal approximation theorems, and activation functions (Sigmoid, Tanh, ReLU, Leaky ReLU, Softmax). Understand vanishing and exploding gradients.
Done when: you can explain the Universal Approximation Theorem and calculate forward activations and softmax cross-entropy probabilities across a 3-layer network on paper.
How to work through it
- Examine the architecture of Multi-Layer Perceptrons (MLPs) with dense weight layers and biases
- Study non-linear activation functions and their mathematical derivatives
- Analyze the vanishing gradient problem in deep saturating networks (Sigmoid/Tanh)
- Derive the multi-class Softmax activation function and categorical cross-entropy loss
- Derive the Backpropagation Algorithm via Computational Graphs~5hLearn1 resource
Backpropagation is the mathematical core enabling gradient descent optimization across deep, composite functions.
You'll learn
- Backpropagation — algorithm for calculating gradients of composite functions using the chain rule along a computational graph
- Computational graph — directed acyclic graph where nodes represent variables or mathematical operations
- Reverse-mode differentiation — algorithmic technique computing derivatives of scalar outputs with respect to all inputs in a single backward pass
Formulate reverse-mode automatic differentiation on directed acyclic computational graphs. Derive backpropagation equations for fully connected layers using the matrix chain rule.
Done when: you can mathematically write out the gradient tensor equations for weight matrices and bias vectors across arbitrary hidden layers in a dense network.
How to work through it
- Represent composite mathematical functions as directed acyclic computational graphs
- Contrast forward-mode and reverse-mode automatic differentiation computational complexity
- Derive layer-wise backward error delta vectors using the multi-variable chain rule
- Derive weight gradient outer products dL/dW = delta * a^(l-1)^T and bias gradients
- Study Deep Learning Optimization and Regularization~4hLearn
Standard gradient descent struggles in deep non-convex landscapes; adaptive optimizers and normalization stabilize training.
You'll learn
- Adam (Adaptive Moment Estimation) — optimization algorithm combining momentum and adaptive learning rates
- Batch Normalization — technique normalizing layer inputs across a mini-batch to stabilize training
- Dropout — regularization method randomly zeroing a fraction of activation units during training
Analyze modern optimization algorithms (SGD with Momentum, RMSprop, Adam) and neural network regularization methods (Dropout, L2 weight decay, Batch Normalization, Layer Normalization).
Done when: you can write down the parameter update equations for Adam optimization and explain the mathematical role of running first and second moment vectors.
How to work through it
- Analyze momentum and Nesterov accelerated momentum mechanics
- Derive RMSprop exponential moving average of squared gradients
- Derive the complete Adam optimizer update rule with bias corrections
- Examine Batch Normalization forward transform and its effect on internal covariate shift
- Build a modular Neural Network framework with Autograd in Python~6hBuild
Constructing an autograd engine from scratch demystifies modern deep learning frameworks like PyTorch.
You'll learn
- Automatic differentiation engine — software subsystem that dynamically builds execution graphs to compute gradients
- MNIST — standard benchmark dataset of 70,000 28x28 grayscale images of handwritten digits
Build an object-oriented deep learning mini-framework from scratch in NumPy (similar to a miniature PyTorch/Micrograd). Implement Tensor, backward computational graph tracking, Layer modules, and Adam optimizer.
Done when: your scratch neural network framework successfully trains an MLP with 2 hidden layers on the MNIST handwritten digit dataset, achieving >95% test accuracy.
How to work through it
- Implement a Tensor class that stores data, grad, and references to creator operations
- Implement backward methods for addition, matrix multiplication, ReLU, and Cross-Entropy
- Create modular Linear, Sequential, and ReLU layer abstractions
- Implement the Adam optimizer class with moving average state buffers
- Train and evaluate your framework on the MNIST digit classification benchmark
Applied Deep Learning with PyTorch
Transition to PyTorch to implement standard architectures: Convolutional Neural Networks for vision and Transformers for sequence modeling.
- Master PyTorch tensors, datasets, and training loops~4hLearn1 resource
PyTorch is the premier research and industry framework for implementing deep learning architectures.
You'll learn
- torch.nn.Module — base class for all neural network modules in PyTorch
- DataLoader — PyTorch utility providing batching, shuffling, and multi-process data loading
- Autograd in PyTorch — PyTorch's automatic differentiation engine that records operations on tensors
Learn idiomatic PyTorch: Tensor operations, GPU acceleration with CUDA/Metal, Dataset and DataLoader pipelines, nn.Module architecture design, loss functions, and custom training/validation loops.
Done when: you have written a clean, modular PyTorch training script that loads data with DataLoader, tracks train/val metrics, and uses checkpointing without memory leaks.
How to work through it
- Learn torch.Tensor manipulation, device placement (.to(device)), and autograd mechanics
- Subclass torch.utils.data.Dataset and configure batching with DataLoader
- Build neural network architectures by subclassing torch.nn.Module
- Write decoupled training, validation, and early stopping loops
- Study Convolutional Neural Networks (CNNs)~4hLearn
CNNs establish the foundational paradigm for processing grid-structured perceptual data.
You'll learn
- Convolutional Layer — layer applying learnable sliding filters to extract local spatial features
- Receptive field — specific region of the input space that affects a particular unit's activation
- Residual connection — skip connection that adds the input of a layer directly to its output
Analyze spatial feature extraction via 2D convolutions. Study receptive fields, kernel strides, padding, pooling layers, channel dimensions, and modern architectures (ResNet residual connections).
Done when: you can calculate output tensor spatial dimensions given input size, kernel dimensions, padding, and stride, and explain why skip connections prevent vanishing gradients in deep ResNets.
How to work through it
- Derive the 2D cross-correlation / convolution operation over multi-channel feature maps
- Calculate receptive field expansion through successive convolutional layers
- Analyze Max-Pooling and Average-Pooling dimension reduction mechanics
- Study residual learning and skip connections (identity mappings in ResNet)
- Study the Transformer Architecture and Multi-Head Self-Attention~5hLearn2 resources
Transformers are the dominant architecture across modern natural language processing, computer vision, and generative AI.
You'll learn
- Self-Attention — attention mechanism relating different positions of a single sequence to compute a representation
- Query, Key, Value (Q, K, V) — linear projections used to compute attention weights and aggregate contextual representations
- Multi-Head Attention — running attention in parallel across multiple subspace representation heads
Examine sequence modeling and the Transformer architecture. Derive Scaled Dot-Product Attention, Query-Key-Value projections, Multi-Head Attention, and positional encodings.
Done when: you can mathematically derive Scaled Dot-Product Attention Attention(Q, K, V) = softmax(Q K^T / sqrt(d_k)) V and explain the computational complexity per layer.
How to work through it
- Analyze the limitations of recurrent architectures (sequential bottleneck)
- Derive the Scaled Dot-Product Attention mathematical formulation
- Study Multi-Head Attention splitting, projection matrices, and concatenation
- Analyze sinusoidal positional encodings and layer normalization placement
- Build a ResNet image classifier and a Transformer Encoder in PyTorch~6hBuild
Implementing deep vision and attention architectures in PyTorch confirms your ability to build production-grade deep learning models.
You'll learn
- CIFAR-10 — benchmark dataset of 60,000 32x32 color images in 10 classes
- Transformer Encoder — stack of self-attention and feed-forward layers processing bidirectional contextual representations
Implement two complete models in PyTorch: a convolutional Residual Network (ResNet-18 style) for CIFAR-10 classification, and a standalone Multi-Head Self-Attention Transformer block from scratch.
Done when: your PyTorch ResNet reaches >85% test accuracy on CIFAR-10, and your custom Transformer Encoder block passes automated forward/backward gradient shape checks on tokenized sequences.
How to work through it
- Construct a custom ResidualBlock class with 2D convolutions, batch normalization, and skip connections
- Build and train a full ResNet model on the CIFAR-10 image dataset
- Implement a standalone MultiHeadAttention class using torch.matmul and softmax
- Combine attention with feed-forward sub-layers and residual layer normalization into a TransformerEncoder
Model Diagnostics, Interpretability & Real-World Validation
Synthesize all skills into a rigorous validation protocol: diagnosing pathological failures, feature attribution, statistical significance testing, and benchmarking.
- Study feature attribution and interpretability methods (SHAP, Permutation Importance)~4hLearn1 resource
Understanding why a complex model makes specific predictions is essential for auditing correctness and detecting spurious correlations.
You'll learn
- Shapley values — average marginal contribution of a feature value across all possible feature coalitions
- Permutation Feature Importance — measure of feature importance based on increase in prediction error after shuffling feature values
- Partial Dependence Plot (PDP) — plot showing the marginal effect of one or two features on the predicted outcome
Learn post-hoc model explainability techniques. Study cooperative game theory Shapley values (SHAP), Permutation Feature Importance, and Partial Dependence Plots (PDP).
Done when: you can mathematically define the Shapley value efficiency and symmetry axioms and compute exact Shapley values on a 3-player cooperative game.
How to work through it
- Study cooperative game theory axioms: efficiency, symmetry, dummy player, additivity
- Derive Shapley values and the TreeSHAP / KernelSHAP approximations
- Implement Permutation Feature Importance measuring out-of-fold metric degradation
- Construct Partial Dependence Plots to visualize non-linear marginal feature effects
- Learn statistical hypothesis testing for model comparisons~4hLearn
Claiming that Model A is better than Model B without statistical significance testing leads to chasing random noise.
You'll learn
- 5x2 cv paired t-test — statistical test designed specifically for comparing machine learning algorithms with controlled Type I error
- McNemar's test — non-parametric statistical test applied to paired nominal data based on disagreement matrices
- Type I error — false positive conclusion that a statistically significant difference exists when it does not
Study statistical significance tests for machine learning model comparisons: paired t-tests, 5x2 cross-validated paired t-tests (Dietterich's test), McNemar's test for classification, and Wilcoxon signed-rank tests.
Done when: you can run a 5x2 cv paired t-test between two classifiers and determine whether the performance difference is statistically significant or indistinguishable from random variance.
How to work through it
- Analyze the false positive rate inflation of naive repeated t-tests on cross-validation folds
- Study Dietterich's 5x2 cross-validated paired t-test for comparing learning algorithms
- Formulate McNemar's test for paired nominal classification outcomes
- Apply the non-parametric Wilcoxon signed-rank test across multiple benchmark datasets
- Study distribution drift and data degradation failure modes~4hLearn
Machine learning models assume independent and identically distributed data; detecting distribution drift is critical for maintaining valid performance.
You'll learn
- Covariate shift — change in the distribution of the input features P(X) while P(Y|X) remains unchanged
- Concept drift — change in the statistical relationship between features and target P(Y|X) over time
- Population Stability Index (PSI) — metric measuring how much a variable has shifted in distribution between two samples
Analyze dataset shift, covariate shift, label shift, and concept drift. Learn statistical distance tests (Kolmogorov-Smirnov test, Population Stability Index, Maximum Mean Discrepancy) to detect data distribution changes over time.
Done when: you can calculate the Population Stability Index (PSI) and run a two-sample Kolmogorov-Smirnov test to detect synthetic covariate shift between two data partitions.
How to work through it
- Differentiate between covariate shift P(X), label shift P(Y), and concept drift P(Y|X)
- Calculate the Population Stability Index (PSI) across numerical feature bins
- Run two-sample Kolmogorov-Smirnov (KS) tests on continuous distributions
- Analyze strategies for model recalibration and retraining triggers upon detected drift
- Execute a rigorous, adversarial model validation benchmark study~8hReview
This comprehensive capstone benchmark demonstrates genuine machine learning competence by synthesizing theory, implementation, and rigorous scientific validation.
You'll learn
- Nested cross-validation — validation protocol with separate inner loops for tuning and outer loops for unbiased performance estimation
- Adversarial validation — methodology of testing whether training and test distributions can be distinguished by a binary classifier
Conduct an end-to-end benchmarking study comparing a linear baseline, a gradient boosted tree (LightGBM/XGBoost), and a deep neural network on a complex tabular dataset containing noisy, correlated, and drifted features. Execute leak-free nested cross-validation, hyperparameter optimization, SHAP feature attribution, statistical significance tests, and drift sensitivity testing.
Done when: you produce an exhaustive benchmark report containing nested cross-validated metrics with confidence intervals, Dietterich 5x2 cv paired significance test results, SHAP global and local attribution plots, and a documented test confirming whether the model relies on spurious correlations.
How to work through it
- Set up a nested cross-validation pipeline (5 outer folds for evaluation, 3 inner folds for hyperparameter tuning)
- Train and tune Logistic Regression, LightGBM/XGBoost, and a PyTorch MLP on the benchmark dataset
- Perform paired 5x2 cv statistical tests to verify whether tree or deep learning improvements are statistically significant
- Run SHAP explainability analyses to audit feature importance and check for target or proxy leakage
- Inject synthetic covariate drift into the test fold and measure model performance degradation curves
How the plan fits together
10 phases in 6 stages. Anything on the same row can be worked on at the same time.
An arrow points from a phase to the work it unlocks: before starting any phase, every phase with an arrow into it has to be finished first.
Resources
22 in this plan's library, beyond the links on individual tasks.
Books & Core Theory
Seminal textbooks on mathematics, statistical learning, and deep learning.
- An Introduction to Statistical Learning (with Applications in Python)
Covers the bias-variance tradeoff, cross-validation, bootstrap sampling, and leakage prevention for disciplined model evaluation.
statlearning.com · Springer · Book · Free digital PDF; paid print
- Deep Learning
Covers deep feedforward networks, optimization surfaces, and backpropagation matrix calculus for implementing deep models from scratch.
deeplearningbook.org · MIT Press · Book · Free online HTML; hardcover paid
- Interpretable Machine Learning: A Guide for Making Black Box Models Explainable
Explains PDP, ALE, Permutation Feature Importance, LIME, and SHAP to detect model artifacts and data leakage.
christophm.github.io · Self-Published / Independent · Book · Free online HTML; paid physical/e-book
- Mathematics for Machine Learning
Bridges vector calculus, matrix decompositions, and optimization directly to machine learning problems to derive loss functions and optimization routines.
mml-book.com · Cambridge University Press · Book · Free digital PDF; print available for purchase
- MIT OpenCourseWare: 18.06SC Linear Algebra
Focuses on fundamental linear algebra concepts to build intuition for least-squares approximations and matrix operations before coding.
ocw.mit.edu · MIT OpenCourseWare · MIT OpenCourseWare · Free
- NumPy
Core scientific computing library in Python providing multidimensional arrays, broadcasting routines, and linear algebra solvers.
numpy.org · NumPy Developers · Library · Free
- NumPy User Guide & Tutorials
Provides tutorials on N-dimensional array manipulation, vectorization, and broadcasting to translate math equations into efficient Python code.
numpy.org · NumPy Project · Documentation · Free
- OpenML
Collaborative platform for machine learning datasets, benchmarking suites, and reproducible algorithmic experiments.
openml.org · OpenML Foundation · Platform · Free
- Pattern Recognition and Machine Learning
Provides rigorous mathematical derivations for linear and logistic regression models based on Gaussian noise assumptions and probabilistic principles.
microsoft.com · Springer · Book · Free PDF; physical hardcovers paid
- Probabilistic Machine Learning: Advanced Topics (Unsupervised Learning Sections)
Grounds clustering, EM for GMMs, PCA, and manifold learning in maximum likelihood estimation and information theory.
probml.github.io · MIT Press · Book · Free draft PDF; printed copies paid
- Probabilistic Machine Learning: An Introduction
Covers probability theory, distributions, Bayesian inference, and MLE to ground real-world data in parametric models.
probml.github.io · MIT Press · Book · Free draft PDF; hardcopies sold
- PyTorch
Tensor library providing automatic differentiation and GPU-accelerated computing for deep neural network architectures.
pytorch.org · PyTorch Foundation / Linux Foundation · Library · Free
- PyTorch Official Tutorials: Learn the Basics & Deep Learning Architectures
Guides through tensor operations, autograd, and constructing CNNs and Transformer modules using idiomatic PyTorch pipelines.
pytorch.org · Linux Foundation · Tutorial · Free
- scikit-learn
Core Python machine learning library providing estimators for regression, classification, clustering, dimensionality reduction, and validation.
scikit-learn.org · scikit-learn Developers · Library · Free
- scikit-learn User Guide: Cross-validation & Evaluation Metrics
Details cross-validation iterators, evaluation metrics, and validation pitfalls such as data snooping and target leakage.
scikit-learn.org · scikit-learn Consortium · Documentation · Free
- Support Vector Machines & Kernel Methods in scikit-learn User Guide
Covers maximal margin classifiers, soft-margin SVMs, dual formulations, and Mercer kernel functions for non-linear boundaries.
scikit-learn.org · scikit-learn Consortium · Documentation · Free
- The Elements of Statistical Learning: Data Mining, Inference, and Prediction
Provides theoretical foundations for CART, boosting algorithms, and Random Forests via bagging and step-wise additive modeling.
hastie.su.domains · Springer · Book · Free PDF
- UCI Machine Learning Repository
Archive of curated tabular, multivariate, and time-series datasets used for evaluating and benchmarking algorithms.
archive.ics.uci.edu · UC Irvine Center for Machine Learning and Intelligent Systems · Dataset Repository · Free
Libraries & Scientific Computing
Core Python packages for numeric calculation, machine learning, and automatic differentiation.
- NumPy Documentation and User Guide
Essential reference for mastering multidimensional array operations, vectorization, and numerical broadcasting without high-level abstractions.
numpy.org · NumPy Developers · Official Documentation · Free · Beginner to Intermediate
- PyTorch Official Documentation and Tutorials
The primary platform documentation for tensor computation, autograd graphs, and production model architectures.
pytorch.org · Linux Foundation / PyTorch · Official Documentation · Free · Intermediate
- scikit-learn User Guide
Comprehensive technical guide containing both mathematical formulations and practical API patterns for classical ML models.
scikit-learn.org · scikit-learn Developers · Official Documentation · Free · Intermediate
Benchmark Datasets
Standardized datasets used for algorithmic verification and empirical benchmarking.
- MNIST Database of Handwritten Digits
Standardized benchmark dataset for verifying custom neural networks and backpropagation implementations from scratch.
yann.lecun.com · Yann LeCun, Corinna Cortes, Christopher J.C. Burges · Dataset · Free · Beginner