MathalyseResearch

Academy · Course · Based on Deep Learning by Goodfellow, Bengio and Courville

Learn AI.

Interactive lessons that follow the book section by section. Every equation is clickable, every idea has a demo you can break, and every section ends with a checkpoint. Learn the whole path from the start, or jump to the one topic you need.

Level 1Newcomer
0 XPStart with any module
0 / 163modules complete
–average mastery

Guided path

Learn from scratch

Go through the modules in book order. A progress bar follows you down the path, each question earns XP, and every module ends with a mastery score that tells you what to revisit.

Free browsing

Pick a module

Open any section or subsection straight away. Your answers still count towards your XP and mastery, so you can mix the two ways of learning.

Your progress is stored in this browser only and never leaves your device. Clearing the site data erases it.

Part I

Applied Math and Machine Learning Basics

Chapter 2 · Linear Algebra

12 of 12 sections available as interactive modules.

2.1 · pp. 31–34

Scalars, Vectors, Matrices and Tensors

Read the four kinds of arrays that deep learning is written in, pick out any element, row, column or subset, flip a matrix across its diagonal, and add arrays of different shapes by broadcasting.

Four kinds of arraysVectors as lists and as pointsMatrices and their indicesTensorsThe transposeAdding arrays and broadcasting
About 30 min
2.2 · pp. 34–36

Multiplying Matrices and Vectors

See how a matrix acts on a vector, how two matrices combine, which algebra rules the product obeys and which it breaks, and how a pile of equations collapses into the single line Ax = b.

One operation, many weighted sumsThe matrix product and its shapesThe dot productRules of the product and the transposeSystems of linear equations
About 30 min
2.3 · pp. 36–37

Identity and Inverse Matrices

Meet the matrix that does nothing, the matrix that undoes another one, and the short argument that solves Ax = b with it. Then see why the book calls the inverse a theoretical tool and not a daily one.

An operation and its undoThe identity matrixThe inverse matrixSolving Ax = b with the inverseThe inverse as a theoretical tool
About 30 min
2.4 · pp. 37–39

Linear Dependence and Span

See a matrix as a set of directions you can travel along, and use that picture to decide when Ax = b has no solution, one, or infinitely many, and exactly when a matrix can have an inverse.

Reaching b along the columnsLinear combinations and spanThe column space and the solvability of Ax = bLinear dependence and independenceCounting solutions and the inverse
About 35 min
2.5 · pp. 39–40

Norms

Measure the size of a vector and a matrix with the Lp norms, know which properties make a function a norm, and choose between the squared L2, L1 and max norms.

Measuring size and the norm propertiesThe Lp family and its unit ballsThe L2 norm and its squareThe L1 norm, the nonzero count and the max normThe Frobenius norm of a matrixThe dot product and the angle
About 30 min
2.6 · pp. 40–42

Special Kinds of Matrices and Vectors

Learn to recognize diagonal, symmetric and orthogonal matrices, and unit and orthogonal vectors, and see why each shape makes arithmetic cheap or geometry simple.

Why special shapes matterDiagonal matricesSymmetric matricesUnit and orthogonal vectorsOrthogonal matrices
About 30 min
2.7 · pp. 42–44

Eigendecomposition

Hunt for the directions a matrix only stretches, write the matrix as eigenvectors times eigenvalues, and read singularity, extremes and definiteness off the eigenvalues.

Decomposing a matrixEigenvectors and eigenvaluesThe eigendecompositionReal symmetric matricesUniqueness and failureWhat the eigenvalues revealDefiniteness
About 40 min
2.8 · pp. 44–45

Singular Value Decomposition

Pull a matrix apart into turn, stretch, turn. Every real matrix, square or not, factors this way, and the pieces connect back to eigenvectors.

A factorization for every matrixThe three factorsRotate, stretch, rotateThe link to eigendecompositionGenerality and the size of singular values
About 35 min
2.9 · pp. 45–48

The Moore-Penrose Pseudoinverse

Solve Ax = y when A has no inverse: see why such systems have no answer or many, define the pseudoinverse as a limit, compute it with the SVD, and recognize what it returns in each case.

Systems with no inverseThe pseudoinverse as a limitComputing it with the SVDWhat the pseudoinverse returnsFitting a line
About 30 min
2.10 · pp. 46–47

The Trace Operator

Add up a diagonal and gain a tool: write the Frobenius norm without sums, move factors around inside a trace, and rewrite a quadratic form as a trace.

Adding up the diagonalThe Frobenius norm as a traceMoving factors around a traceThe trace applied to a direction
About 30 min
2.11 · pp. 47

The Determinant

See the determinant as the factor by which a matrix scales area and volume, connect it to the product of the eigenvalues, and recognize what a determinant of 0 or 1 does to space.

The scaling factor of spaceThe product of the eigenvaluesDeterminant 0 and determinant 1Combining transformations
About 30 min
2.12 · pp. 48–52

Example: Principal Components Analysis

Squash points onto a line and rebuild them: derive PCA from linear algebra alone, then find the directions that lose the least.

Lossy compression of pointsEncoder, decoder and constraintsThe optimal codeEncoder and reconstructionChoosing D for all pointsThe trace derivationThe first principal componentSeveral components and the algorithm
About 45 min

Chapter 3 · Probability and Information Theory

14 of 14 sections available as interactive modules.

3.1 · pp. 54–56

The Need for Probability

Why a learning system cannot avoid uncertainty: the three sources it comes from, why a simple uncertain rule can beat a perfect one, and what a probability number means.

Why probability is neededThree sources of uncertaintySimple uncertain rulesFrequencies and degrees of beliefCoherent beliefs and logic extended
About 35 min
3.2 · pp. 56

Random Variables

What a random variable is, why it needs a probability distribution before it says anything about chance, how to read the notation for a variable and its values, and how discrete and continuous variables differ.

A variable driven by chanceVariable and valueDiscrete random variablesContinuous random variables
About 30 min
3.3 · pp. 56–58

Probability Distributions

How to write down chance: a probability mass function for discrete variables, a joint distribution for several variables, a density for continuous ones, and the uniform distribution in both settings.

Spreading one unit of probabilityProbability mass functionsJoint distributionsThe uniform distribution over statesProbability density functionsThe uniform distribution on an interval
About 40 min
3.4 · pp. 58–59

Marginal Probability

How to get the distribution of one variable out of a joint distribution: add up the other variable in the discrete case, integrate it out in the continuous case, and see what the result loses.

Writing totals in the marginThe sum ruleWhat the margin discardsIntegrating out a continuous variableSumming out several variables
About 35 min
3.5 · pp. 59

Conditional Probability

How to update the probability of one thing once you know another happened: the definition as a renormalized slice of the joint table, the one restriction it needs, why the direction of the condition matters, and why seeing is not doing.

Restricting attentionThe definitionWhen the condition never happensThe direction of the conditionConditioning is not intervening
About 35 min
3.6 · pp. 59–60

The Chain Rule of Conditional Probabilities

Any joint distribution over many variables can be rebuilt from one small conditional distribution per variable. You will see why this is true, why the order does not matter, and why it is the recipe behind sampling and behind modern sequence models.

A joint distribution built from questionsThe rule and its derivationAny order gives the same answerSampling and counting parameters
About 30 min
3.7 · pp. 60

Independence and Conditional Independence

When does knowing one variable tell you nothing about another? You will learn independence as a factorization test, see why finite data always looks slightly dependent, and meet conditional independence, the assumption that makes large probabilistic models affordable.

Independence as a factorizationIndependence in finite dataConditional independenceNotation and why it pays off
About 30 min
3.8 · pp. 60–62

Expectation, Variance and Covariance

The three standard summaries of a distribution: the average value of a function (expectation), how widely it spreads (variance), and how two variables move together (covariance). You will also see why zero covariance does not mean independence.

Expectation as a balance pointExpectation of a continuous variableLinearity of expectationVariance and standard deviationCovariance and correlationZero Covariance and DependenceThe covariance matrix
About 40 min
3.9 · pp. 62–68

Common Probability Distributions

The small family of distributions that deep learning uses again and again: Bernoulli, multinoulli, Gaussian, exponential, Laplace, Dirac and mixtures. For each you will see what its parameters do, why it is useful, and what it cannot express.

Named families of distributionsBernoulli distributionMultinoulli distributionGaussian distributionReasons for the Gaussian defaultMultivariate GaussianExponential and Laplace distributionsDirac and empirical distributionsMixtures of distributions
About 40 min
3.10 · pp. 67–70

Useful Properties of Common Functions

Meet the sigmoid, which turns any score into a probability, and the softplus, which turns any score into a positive scale. Watch the sigmoid saturate, then check the identities that tie the two functions together.

The logistic sigmoidSaturationThe softplus functionIdentities for sigmoid and softplusInverse functionsIntegral and the positive part
About 35 min
3.11 · pp. 70–71

Bayes’ Rule

Turn a conditional probability around. You will compute the probability of a cause after you see an observation, from how likely the observation is under each cause and from the prior, and you will see why the base rate can decide the answer.

Reversing a conditionalThe rule and where it comes fromUpdating with one observation at a timeThe base rate and the direction of the question
About 30 min
3.12 · pp. 71–73

Technical Details of Continuous Variables

Three technical ideas that make continuous probability safe to use: sets of measure zero, properties that hold almost everywhere, and the Jacobian factor that corrects a density when a variable is transformed.

Densities, sets and integrationMeasure zeroAlmost everywhereTransforming a random variableThe Jacobian in higher dimensions
About 40 min
3.13 · pp. 73–76

Information Theory

Measure surprise, uncertainty and the gap between two distributions: self-information, Shannon entropy, differential entropy, the KL divergence and its direction, cross-entropy, and the convention 0 log 0 = 0.

Self-informationShannon entropyContinuous variables and differential entropyThe KL divergenceThe direction of the divergenceCross-entropy and the 0 log 0 convention
About 40 min
3.14 · pp. 75–79

Structured Probabilistic Models

Describe a distribution over many variables as a product of small factors, draw the factorization as a directed or undirected graph, and read independences off the graph. Edit the graphs yourself and watch the formulas follow.

Why a joint distribution needs structureFactorizing a joint distributionDirected modelsUndirected models and the partition functionOne distribution, two descriptionsThe energy-based formSeparation and d-separation
About 45 min

Chapter 4 · Numerical Computation

5 of 5 sections available as interactive modules.

4.1 · pp. 80–81

Overflow and Underflow

Why a computer cannot hold every real number, how exp() blows up or vanishes, and the one-line shift that makes softmax and log softmax safe to compute.

Finite numbers for infinitely many realsUnderflow and overflowSoftmax with equal inputsThe shift that stabilizes softmaxLog softmaxLetting libraries do the work
About 35 min
4.2 · pp. 82

Poor Conditioning

How a matrix can magnify tiny errors in its input, how the condition number measures that magnification, and why the sensitivity belongs to the matrix and not to the algorithm.

Sensitivity to small changesThe condition numberA property of the matrix itselfLiving with a large condition number
About 35 min
4.3 · pp. 82–92

Gradient-Based Optimization

Minimize a function by following its slope: the gradient and its directions, step sizes, the Jacobian and Hessian, saddle points, Newton’s method, and the guarantees that Lipschitz continuity and convexity give.

Downhill along the slopeCritical pointsGradients and steepest descentChoosing the step sizeThe Jacobian and the second derivativeThe Hessian matrixThe optimal step from the Taylor expansionConditioning and Newton’s methodLipschitz continuity and convexity
About 35 min
4.4 · pp. 93–96

Constrained Optimization

How to minimize a function when the answer must stay inside a set: projecting back, changing variables, and the generalized Lagrangian with its multipliers, the minimax form and the KKT conditions.

Feasible points and projected stepsChanging variablesDescribing the set and the LagrangianThe minimax form and why it is exactMaximizing, and the sign of the equality termActive constraints and zero multipliersThe KKT conditions
About 45 min
4.5 · pp. 96–97

Example: Linear Least Squares

How to minimize a least squares objective by gradient descent and by Newton’s method, and how to add the constraint that the solution has length at most 1 with a Lagrangian and gradient ascent on its multiplier.

The least squares objective and its gradientGradient descent on least squaresNewton’s method on a quadraticThe constrained solution and its multiplierFinding the multiplier by gradient ascent
About 35 min

Chapter 5 · Machine Learning Basics

11 of 11 sections available as interactive modules.

5.1 · pp. 99–110

Learning Algorithms

What it means for a program to learn: the task, the performance measure and the experience, and then the first complete learning algorithm, linear regression, with its normal equations and bias term.

Learning from experienceClassification and images as vectorsRegression and structured outputDensity estimation and the other tasksThe performance measureThe experience: datasets, clusters and the chain ruleLinear regression and its errorThe normal equationsThe bias term
About 40 min
5.2 · pp. 110–120

Capacity, Overfitting and Underfitting

Why low training error is not the goal: generalization, the capacity of a model, the U-shaped error curve, the no free lunch theorem and how regularization expresses preferences.

GeneralizationCapacity and polynomial modelsUnderfitting, overfitting and the U-curveHypotheses, Occam and the VC dimensionNon-parametric models and more dataThe no free lunch theoremRegularization and weight decay
About 40 min
5.3 · pp. 120–123

Hyperparameters and Validation Sets

Why some settings must be chosen outside the training set, how a validation set and k-fold cross-validation estimate generalization, and why a reused test set goes stale.

HyperparametersThe validation setThe test set and stale benchmarksk-fold cross-validationSingle splits, folds and confidence intervals
About 40 min
5.4 · pp. 122–131

Estimators, Bias and Variance

Treat an estimate as a random quantity, split its error into bias and variance, and see why a slightly biased estimator can beat an unbiased one.

One dataset, many possible answersPoint estimationBiasVariance and standard errorTrading off bias and varianceConsistency
About 40 min
5.5 · pp. 131–135

Maximum Likelihood Estimation

Derive estimators from one principle, see why it reduces to minimizing a KL divergence, a cross-entropy or a mean squared error, and learn when it can be trusted.

The maximum likelihood principleLogarithms and the empirical expectationMinimizing KL divergenceConditional log-likelihood and mean squared errorProperties of maximum likelihood
About 40 min
5.6 · pp. 135–140

Bayesian Statistics

Treat a parameter as uncertain, update the belief with Bayes rule, predict with the whole posterior, and see why a Gaussian prior on the weights becomes weight decay when you keep only the most probable parameters.

Parameters as random variablesPrediction with the full posteriorExample: Bayesian linear regressionThe posterior mean and weight decayMaximum a posteriori (MAP) estimation
About 40 min
5.7 · pp. 140–146

Supervised Learning Algorithms

Four classic ways to learn a rule from labeled examples: logistic regression, support vector machines with the kernel trick, nearest neighbors and decision trees. Run each one, break it, and see what it assumes.

Learning from labeled examplesProbabilistic supervised learningSupport vector machinesThe kernel trickThe Gaussian kernel and support vectorsk-nearest neighborsDecision treesThe same data through four lenses
About 45 min
5.8 · pp. 146–151

Unsupervised Learning Algorithms

How to find a useful description of data without any labels: PCA rotates the data until its coordinates are uncorrelated, and k-means replaces each point by the index of its cluster.

Representations without labelsPCA as a learned representationWhy the covariance becomes diagonalCompression and the limit of decorrelationk-means clusteringOne-hot versus distributed representations
About 45 min
5.9 · pp. 151–153

Stochastic Gradient Descent

Learn why one small random minibatch can steer training, how its error shrinks with the batch size, why a constant learning rate leaves a noise floor, and why one update does not get more expensive as the data grows.

Large data, expensive stepsThe cost as a sum over examplesMinibatch estimatesThe update and a constant learning rateCost that does not grow with the data
About 40 min
5.10 · pp. 153–155

Building a Machine Learning Algorithm

See that many learning algorithms are one recipe with four swappable parts, a dataset, a cost, a model and an optimizer, and build the combinations yourself.

The four-part recipeLinear regression and its optimizerThe cost: weight decayThe model: no closed formThe data: unsupervised learningSpecial-case optimizersThe recipe builder
About 40 min
5.11 · pp. 155–165

Challenges Motivating Deep Learning

See why simple learners fail on high-dimensional data: configurations multiply, local smoothness runs out, and the manifold idea gives deep learning a way forward.

Why simple algorithms stallThe curse of dimensionalityLocal constancy and smoothnessNon-local generalizationManifold learningEvidence for the manifold hypothesisCoordinates on the manifold
About 45 min
Part II

Deep Networks: Modern Practices

Chapter 6 · Deep Feedforward Networks

6 of 6 sections available as interactive modules.

6.1 · pp. 171–176

Example: Learning XOR

Learn why one straight line cannot compute XOR, and build a two-unit ReLU network that computes it, one matrix at a time.

The big pictureThe data and the lossWhy no linear model does betterA hidden layer that bends the spaceWalking through the batchWhat the example leaves out
About 30 min
6.2 · pp. 177–190

Gradient-Based Learning

Choose a cost function and an output unit that match the data, so that the gradient stays large where the model is wrong and training keeps moving.

Training by descent on a non-convex lossLearning by maximum likelihoodLearning conditional statisticsLinear units and the problem of saturationSigmoid output units for binary targetsSoftmax output units for classesOther output types and mixtures
About 40 min
6.3 · pp. 191–196

Hidden Units

Choose the bend of a hidden unit by checking its slope and its saturation, because those two properties decide whether gradient descent keeps learning through the unit.

Hidden units as bendsDerivatives at the kinkRectified linear unitsGeneralizations of rectified linear unitsMaxout unitsLogistic sigmoid and hyperbolic tangentOther hidden units
About 35 min
6.4 · pp. 197–203

Architecture Design

Read a network as a chain of layers, count its parameters, and see what the universal approximation theorem does and does not promise. You will also see how depth multiplies the number of pieces a rectifier network can make, and what skip and sparse connections change.

Layers as a chainEnough hidden unitsEnough units is not a guaranteeDepth folds the input spaceBounds on the number of piecesOther architectural considerationsEvidence and the takeaway
About 30 min
6.5 · pp. 204–224

Back-Propagation and Other Differentiation Algorithms

Compute a gradient by applying the chain rule backwards through a computational graph. You will see why reusing shared work saves so much computation, how the same idea trains a small network, and where the method stops being the cheapest choice.

Computational graphsThe chain ruleReusing shared workBack-propagation in a networkSymbol-to-symbol derivativesGeneral back-propagationTraining with weight decayComplications and other ways to differentiateHigher-order derivatives
About 45 min
6.6 · pp. 224–227

Historical Notes

Trace how the chain rule, gradient descent and back-propagation reached deep learning, why the early linear models stalled, and why cross-entropy and rectified units changed training. Each idea has a small demo you can test.

Function approximation and the long roadLinear models and the XOR problemGradient descent and the chain ruleCross-entropy and saturationSaturation through depthRectified units and the modern era
About 30 min

Chapter 7 · Regularization for Deep Learning

14 of 14 sections available as interactive modules.

7.1 · pp. 230–236

Parameter Norm Penalties

Add a price for size to a loss, predict how that price pulls the best weights towards zero, and see why the L2 and L1 prices leave different marks on the solution.

A penalty as a price on sizeWeight decay in one stepShrinking along curvature directionsLinear regression with weight decayThe L1 penalty and its gradientSparsity and the soft thresholdThe Laplace prior
About 40 min
7.2 · pp. 237–238

Norm Penalties as Constrained Optimization

See a norm penalty as a limit on the size of the weights, follow the penalty strength as a Lagrange multiplier, and compare a hard limit that is enforced by reprojection with a soft price.

A penalty as a limit on sizeThe Lagrangian and the penalty strengthExplicit limits and reprojectionOne limit for each column
About 35 min
7.3 · pp. 239–240

Regularization and Under-Constrained Problems

See why some problems have no single answer, how a ridge term makes the inverse exist, and why the pseudoinverse is the limit of ridge regression as the penalty shrinks to zero.

When the answer is not uniqueWhen the matrix has no inverseThe pseudoinverse as a limitSeparable data and weight decay
About 30 min
7.4 · pp. 240–241

Dataset Augmentation

Make more training examples from the ones you have, keep the label when you change the input, add noise to inputs as a kind of augmentation, and compare methods only when they share the same augmentation.

Making more examples that keep their labelNoise in the inputSorting the operationsA fair comparison
About 30 min
7.5 · pp. 242–243

Noise Robustness

See how noise on the inputs of a linear model acts like a weight penalty, why noise on the weights leaves a linear model unchanged, and how label smoothing keeps a classifier from chasing probabilities of exactly one.

Noise on the inputs of a linear modelNoise on the weightsLabel smoothingNoise and the penalty side by side
About 35 min
7.6 · pp. 243–244

Semi-Supervised Learning

Learn how one model can use many unlabeled examples together with a few labeled ones, through a learned representation and a shared parameter, and when that choice helps.

Labeled and unlabeled examplesA representation from unlabeled dataSharing parameters with a generative modelWhen unlabeled data helps
About 25 min
7.7 · pp. 244–246

Multi-Task Learning

Learn how several related tasks can share a part of one network, why pooling their examples constrains the shared part, and when that sharing fails.

Shared and task-specific partsPooling examples for a shared partWhen the shared part is wrongParameter budget and the summary
About 25 min
7.8 · pp. 246–252

Early Stopping

Learn how training time acts as a hyperparameter, how early stopping chooses it, and why stopping early behaves like L2 regularization.

The validation curveRetraining on all the dataTraining time as a limit on the pathMatching L2 regularization and the summary
About 30 min
7.9 · pp. 253–254

Parameter Tying and Sharing

Learn how two models can be tied by a penalty or by sharing one set of weights, why a convolution reuses its kernel at every position, and what shifting the input does to the output.

Tying with a penaltyCounting the parameters that sharing savesShifting the inputSorting the kinds of tying and the summary
About 25 min
7.10 · pp. 254–256

Sparse Representations

Learn how sparse representations differ from sparse parameters, how an L1 penalty on activations sets units exactly to zero, and how OMP-k limits the number of nonzero entries.

Sparse parameters and sparse representationsPenalties on the activationsHard sparsity with OMP-kAverage activation and the summary
About 30 min
7.11 · pp. 256–258

Bagging and Other Ensemble Methods

Average several models, measure how much the average gains from the correlation of their errors, and build a bagged ensemble by resampling the training set with replacement.

A panel of forecastersAveraging and error correlationResampling with replacementBagged votesDiversity, boosting and cost
About 30 min
7.12 · pp. 258–268

Dropout

Train an exponentially large ensemble of sub-networks by removing units at random, then average them cheaply with the weight scaling rule, and see why the randomness regularizes.

Dropout as a cheap ensembleSub-networks and their pathsTraining with random masksAveraging the ensembleWhy the noise helpsCost, capacity and limits
About 40 min
7.13 · pp. 268–270

Adversarial Training

Find inputs that a trained network gets wrong, see why small changes add up in linear models, and use adversarial training to make a network locally constant near its data.

Inputs the network gets wrongThe sign step and Figure 7.8Why small changes add upAdversarial training and local constancyVirtual adversarial examples
About 30 min
7.14 · pp. 270–273

Tangent Distance, Tangent Prop and the Manifold Tangent Classifier

Use the manifold hypothesis to make a classifier invariant to movement along the data manifold: tangent distance, the tangent prop penalty, the ReLU problem, and a local stand-in for the manifold tangent classifier.

Tangent distanceTangent prop and its penaltyTangent prop against dataset augmentationDouble backprop and adversarial trainingThe manifold tangent classifier
About 35 min

Chapter 8 · Optimization for Training Deep Models

8 of 7 sections available as interactive modules.

8.1 · pp. 275–281

How Learning Differs from Pure Optimization

Explain why training minimizes a proxy for the goal, why minimizing the training error can overfit, why a surrogate loss and early stopping are used, and why a minibatch gives an honest but noisy gradient.

The goal and the number you can computeEmpirical risk and overfittingSurrogate losses and early stoppingMinibatch estimates of the gradientMinibatch size and shuffling
About 35 min
8.2 · pp. 282–293

Challenges in Neural Network Optimization

Explain the main obstacles to optimizing a neural network: ill-conditioning, local minima and symmetries, saddle points, cliffs, inexact gradients, and the gap between local moves and global structure, with the book's limits on what any algorithm can guarantee.

Why optimization is hardIll-conditioningLocal minima and symmetriesSaddle points and flat regionsCliffs and exploding gradientsInexact gradientsPoor correspondence and theoretical limits
About 35 min
8.3 · pp. 294–300

Basic Algorithms

Explain stochastic gradient descent, why its learning rate must decay for convergence, what momentum and Nesterov momentum do to the path, and what the terminal velocity and the physical picture of momentum mean.

Stochastic gradient descentLearning rate schedulesConvergence ratesMomentumTerminal velocity and the physical pictureNesterov momentum
About 38 min
8.3.2 · pp. 296–300

Momentum

One subsection of the book, taught step by step: the velocity that remembers past gradients, the speed limit it creates, and the physical picture behind it.

The problemThe update ruleWhat the velocity remembersSpeed limitAlgorithm 8.2The physical picture
About 30 min
8.4 · pp. 301–306

Parameter Initialization Strategies

Explain why the initial parameters must break symmetry, how the scale of random weights controls signal and gradients, why the biases and variance parameters are set separately, and how initialization acts as a prior.

Why initialization mattersRandom weights and their scaleSparse initialization and the scale as a hyperparameterInitialization as a priorBiases and special parametersInitialization from other learning
About 36 min
8.5 · pp. 306–310

Algorithms with Adaptive Learning Rates

Give every parameter its own learning rate, and see how AdaGrad, RMSProp and Adam change that rate from the history of their gradients.

The problem: one learning rate for every parameterAdaGrad: a rate that shrinks with historyRMSProp: forgetting the distant pastAdam: momentum, a second moment and bias correctionNesterov look-ahead and choosing an algorithm
About 35 min
8.6 · pp. 310–317

Approximate Second-Order Methods

Use curvature to choose better steps: Newton’s method, its regularized form, conjugate gradients and BFGS, and the cost each one pays to avoid the full Hessian.

Slope and curvature from one pointNewton’s methodRegularized Newton and the cost of the HessianConjugate gradientsBFGS and its low-memory form
About 32 min
8.7 · pp. 317–329

Optimization Strategies and Meta-Algorithms

Change the model, the optimizer, the starting point or the output to make deep networks easier to train: batch normalization, coordinate descent, Polyak averaging, pretraining, better model design and continuation.

Sorting the strategiesBatch normalizationCoordinate descentPolyak averagingSupervised pretrainingDesigning models to aid optimizationContinuation methods and curriculum learning
About 36 min

Chapter 9 · Convolutional Networks

11 of 11 sections available as interactive modules.

9.1 · pp. 331–334

The Convolution Operation

Compute a convolution by sliding a kernel along an input, in one and two dimensions, see what the kernel flip does, and write the same operation as a sparse matrix.

A smoothing filter for a noisy sensorDiscrete convolution as a sumTwo dimensions and the kernel flipConvolution as a sparse matrix
About 35 min
9.2 · pp. 335–338

Motivation

Explain why convolution uses sparse connections, shared parameters and translation equivariance, and count the savings for a real image.

A stencil that slides over the inputSparse connections and receptive fieldsParameter sharingEdge detection and the cost of convolutionEquivariance to translation
About 35 min
9.3 · pp. 339–344

Pooling

Explain what a pooling function summarizes, why max pooling tolerates small shifts, how a stride shrinks a layer, and how pooling gives a fixed number of summaries for inputs of any length.

One summary per neighborhoodPooling functionsInvariance to small shiftsLearned invariancesDownsampling with a strideSummaries for inputs of any length
About 30 min
9.4 · pp. 345–347

Convolution and Pooling as an Infinitely Strong Prior

Explain why convolution and pooling act as infinitely strong priors, build a local and shared layer from a dense one, and see when such a prior underfits.

A rubber stamp as a strong priorLocality and sharing as a prior on weightsPooling as invariance to small shiftsWhen the prior underfitsComparing models fairly
About 35 min
9.5 · pp. 347–357

Variants of the Basic Convolution Function

Read the convolution that neural networks really use: many kernels at once, strides, zero padding, locally connected and tiled layers, the gradients that training needs, and bias terms. Each variant has a demo that you can change.

The big pictureMany kernels for many channelsStride: skipping output positionsZero padding and the size of the outputLocally connected layers and channel groupsTiled convolutionGradients and the transposeBias terms
About 35 min
9.6 · pp. 358–359

Structured Outputs

Turn one label per image into one label per pixel. See why the output map can shrink, how a recurrent network refines its first guess, and how neighboring pixels form regions.

The big pictureThe output plane can be too smallRefining the guess with a recurrent networkSmoothing pixels into regions
About 25 min
9.7 · pp. 360–361

Data Types

See the shapes of data that convolution reads, from audio to color video. Learn why a shift in the input shifts the output, how to get a fixed-size output from a variable-size input, and when convolution does not fit.

The big pictureShifts in time and spaceInputs of different sizesWhen convolution does not fit
About 25 min
9.8 · pp. 362

Efficient Convolution Algorithms

Make convolution cheaper without changing its answer. Compare the cost of a full kernel and a separable kernel, build a kernel from two vectors, and see how the Fourier transform gives the same result by a different route.

The big pictureSeparable kernelsThe Fourier routeChoosing the cheapest method
About 20 min
9.9 · pp. 363–364

Random or Unsupervised Features

Explain why a convolutional network can learn useful kernels without supervised training, cluster patches into a bank of kernels, see why random filters followed by pooling already respond to moved patterns, and count the cost of each way of training.

Why the features are the costly partKernels from clustering patchesRandom filters and poolingChoosing architectures cheaply
About 25 min
9.10 · pp. 364–371

The Neuroscientific Basis for Convolutional Networks

Trace the link from simple and complex cells in the visual cortex to convolutional layers, build a Gabor filter yourself, recover a hidden filter from noisy responses, and see where the cartoon stops matching the brain.

A cartoon of the visual cortexSimple cells, complex cells and small shiftsStacking detection and poolingWhere the cartoon breaksGabor functions and reverse correlationQuadrature pairs and the complex cellLearned features that look like Gabor functions
About 40 min
9.11 · pp. 371–372

Convolutional Networks and the History of Deep Learning

Trace the milestones that made convolutional networks central to early deep learning, test why they worked first, count parameters against a dense layer, and see how stacked layers grow what one unit can see.

A short historyWhy convolutional networks worked firstStacking layers grows the receptive fieldGrid-structured data and the handoff to Chapter 10
About 25 min

Chapter 10 · Sequence Modeling: Recurrent and Recursive Nets

12 of 12 sections available as interactive modules.

10.1 · pp. 375–377

Unfolding Computational Graphs

Turn a recurrent definition into a chain of identical steps, count how many copies of the same rule a finite chain contains, and explain why one set of parameters can serve every time step.

The big pictureUnfolding the recurrenceA signal from outsideSharing one rule across time
About 25 min
10.2 · pp. 378–393

Recurrent Neural Networks

Run the forward pass of a recurrent network, read its loss over a sequence, compute gradients by back-propagation through time, and see how teacher forcing, graphical models and context change what the network can learn.

The big pictureThe forward passThe loss over timeThree wirings of the recurrenceTeacher forcingBack-propagation through timeGradients of shared weightsRecurrent networks as graphical modelsA fixed context
About 40 min
10.3 · pp. 394–395

Bidirectional RNNs

Explain why some tasks need the future as well as the past, read the two recurrences of a bidirectional network, measure how much each input counts for an output, and see how the idea extends to grids.

The big pictureTwo passes over the sequenceHow much each input countsBeyond sequences: grids
About 25 min
10.4 · pp. 396–398

Encoder-Decoder Sequence Models

Map an input sequence to an output sequence of a different length with an encoder, a context and a decoder, see why a fixed-size context can run out of room, and see how attention lets the decoder read the input in parts.

The big pictureThe encoder and the contextThe decoderA fixed-size context and attention
About 25 min
10.5 · pp. 398–399

Deep Recurrent Networks

Split one step of a recurrent network into its three blocks, add hidden layers to each block, and count how the length of the route between time steps changes.

Three blocks in one stepDepth inside each blockRoutes and skip connectionsWhich block to deepen
About 30 min
10.6 · pp. 400–401

Recursive Neural Networks

Read a sequence as a tree instead of a chain, count how the depth of a balanced tree grows, and follow one forward pass with weights shared across the tree.

A tree instead of a chainMerging neighbors and depthOne set of weights at every nodeDepth against sequence length
About 25 min
10.7 · pp. 401–403

The Challenge of Long-Term Dependencies

Multiply by one weight, then by a matrix, then by many random layers, and see why repeated products vanish or explode.

Repeated multiplication by one numberEigen directions and the power methodMany layers with fresh weightsComposing a nonlinear map
About 30 min
10.8 · pp. 404–405

Echo State Networks

Fix the recurrent weights, learn only a linear readout, and measure how long the state remembers, how fast it forgets, and how a non-normal matrix can stretch a single step.

A pond that remembersReading the memory from the stateForgetting and the edge of stabilityLearning only the readoutSeparation and non-normal matrices
About 35 min
10.9 · pp. 406–408

Leaky Units and Multiple Time Scales

Build memory at several speeds with leaky averages, skip connections and slow groups, and read off how far each part of the model can reach back in time.

Many time scalesSkip connections through timeLeaky units and their time constantsRemoving connections
About 25 min
10.10 · pp. 408–412

The Long Short-Term Memory and Other Gated RNNs

Read an LSTM cell and a GRU as a set of valves that decide what to keep, what to write and what to show, and test each valve on a memory task.

Gates as valvesThe LSTM cellState update and outputGated recurrent unitsOther gated RNNs and what matters
About 35 min
10.11 · pp. 413–416

Gradient Clipping and Information Flow

Tame steep cliffs in the loss surface by capping the gradient, compare two ways of clipping, and read a regularizer that keeps the gradient from shrinking as it moves back through time.

Cliffs in the loss surfaceSecond derivatives and steepnessClipping the gradientElement-wise and norm clippingRegularizing for information flow
About 30 min
10.12 · pp. 416–420

Explicit Memory and Soft Reads

Compare knowledge held in weights with knowledge held in memory cells, read memory with soft and hard addressing, and see why content and location addressing differ.

Two kinds of knowledgeStoring facts by gradient descentMemory cells and soft readsContent and location addressingHard reads and attention
About 30 min

Chapter 11 · Practical Methodology

6 of 6 sections available as interactive modules.

11.1 · pp. 422–424

Performance Metrics

Choose the number that matches the goal: see why accuracy can mislead on rare events, trade precision against recall with a threshold, and refuse uncertain cases to buy accuracy with coverage.

The error no model can beatError rate and the cost of each mistakeThe accuracy trap for rare eventsPrecision, recall and the PR curveOne number: the F-score and the area under the curveRefusing to answer: coverageChoosing the metric before tuning
About 30 min
11.2 · pp. 425–426

Default Baseline Models

Start with the model family that fits the shape of your data, a piecewise linear unit, a decaying learning rate and early stopping, and copy a known model whenever a similar task already has one.

The first system to buildPiecewise linear units to start withLearning-rate schedulesEarly stoppingRegularization and batch normalizationReuse, copying and unsupervised starts
About 30 min
11.3 · pp. 426–427

Determining Whether to Gather More Data

Check the training error first, then the test error and the gap between them. Gather more data when the gap stays large after regularization, and grow the data on a doubling scale.

Training error firstTest error, the gap and regularizationLearning curves on a doubling scaleDoubling, not adding a littleThe gather-or-not game
About 30 min
11.4 · pp. 427–435

Selecting Hyperparameters

Choose the settings that training does not learn: how capacity, the learning rate and the search method decide the result, and how grid, random and model-based search differ.

Hyperparameters and capacityThe learning rate curveWhich knob does whatAutomatic search and grid searchRandom search on a log scaleModel-based search and the takeaways
About 35 min
11.5 · pp. 436–439

Debugging Strategies

Find out whether a poor result is the method or a bug: read the worst mistakes, compare training and test error, fit one example, and check gradients numerically.

Why bugs are hard to seeLook at the worst mistakesCompare training and test errorFit a tiny datasetCheck gradients by finite differencesSaturation, update sizes and guarantees
About 35 min
11.6 · pp. 440–442

Example: Multi-Digit Number Recognition

Follow a real project from metric to fix: trade coverage against accuracy, score a whole address, read the errors, and widen the crop.

Choose the metricScore a whole addressCompare train and test errorRead the worst mistakesWiden the crop, then tune the model
About 30 min

Chapter 12 · Applications

5 of 5 sections available as interactive modules.

12.1 · pp. 443–451

Large-Scale Deep Learning

Explain why deep learning needs large and parallel computation, and what each family of tricks in the book buys: cache-friendly and branch-free code, asynchronous updates, smaller models for inference, cascades and gaters, and low-precision numbers.

Many weak units working togetherFast CPU code and cache linesGPUs, warps and memory segmentsDistributed updates and stale gradientsCompression: a small student from a large teacherDynamic structure: cascades and gatersSpecialized hardware and low precision
About 35 min
12.2 · pp. 452–458

Computer Vision

Explain why computer vision needs a common pixel scale, what global and local contrast normalization do, and how dataset augmentation and test-time voting reuse the same invariances. Every demo is a toy built for this page.

Computer vision and the scale of pixelsGlobal contrast normalizationMapping examples onto a sphereLocal contrast normalizationDataset augmentation and voting
About 35 min
12.3 · pp. 458–460

Speech Recognition

Explain speech recognition as a most-probable-sequence search, how audio is cut into frames, why the acoustic and language parts are weighed against each other, and how deep networks replaced parts of the GMM-HMM pipeline.

From sound to framesThe most probable wordsFrom GMM-HMM to deep networksMilestones and end-to-end systems
About 25 min
12.4 · pp. 461–477

Natural Language Processing

Explain n-gram language models and their counting estimates, why smoothing and distributed word representations are needed, how the output layer over a large vocabulary is made cheaper, and how attention lets a translation model read a whole sentence.

Counting words in contextSmoothing and the curse of dimensionalityEmbeddings for wordsHigh-dimensional outputsAttention and translation
About 35 min
12.5 · pp. 478–485

Other Applications

Explain how recommender systems predict user-item associations with embeddings and a bilinear rule, why exploration is needed when the system only sees the items it shows, and how knowledge bases store facts as triplets that are ranked by corruption.

Recommender systemsExploration versus exploitationKnowledge bases and tripletsLink prediction and question answering
About 25 min
Part III

Deep Learning Research

Chapter 13 · Linear Factor Models

5 of 5 sections available as interactive modules.

13.1 · pp. 490–491

Probabilistic PCA and Factor Analysis

Describe data as a few hidden factors plus noise, read the covariance WWᵀ + ψ off a factor model, and see how probabilistic PCA turns into PCA as the noise shrinks.

The big pictureFactor analysisProbabilistic PCAThe sharp limit and the projection
About 30 min
13.2 · pp. 491–493

Independent Component Analysis (ICA)

Recover hidden sources from mixtures: why independence needs more than decorrelation, why the sources must be non-Gaussian, and how the choice of prior and the constraint on the mixing matrix shape the method.

Unmixing the roomWhitening and the uncorrelated trapWhy the sources must be non-GaussianVariants and extensions
About 35 min
13.3 · pp. 493–496

Slow Feature Analysis

Learn features that change slowly over time: the slowness principle, the linear SFA objective with its three constraints, why the features must be decorrelated, and how a quadratic basis lets SFA find slowness hidden in a nonlinear signal.

The slowness principleThe SFA objective and its constraintsOrdering and decorrelationSlowness through a basis expansion
About 35 min
13.4 · pp. 496–499

Sparse Coding

Model data as a sparse combination of a dictionary of features: the Laplace and Student-t priors, inference as a lasso problem with exact zeros, learning by alternating encoding and decoding, and why sparse codes do not make good samples.

A linear decoder with a sparse priorInference as a lasso problemLearning the dictionary by alternationSparse codes versus sparse samples
About 35 min
13.5 · pp. 499–501

Manifold Interpretation of PCA

Read PCA as fitting a flat pancake of high probability to data: the encoder and decoder of a linear autoencoder, the minimum reconstruction error as the sum of the discarded eigenvalues, and the equivalence with maximising the variance of the code.

Probabilistic PCA as a flat GaussianEncoder, decoder and reconstruction errorThe error is the discarded eigenvaluesMaximising variance gives the same subspace
About 30 min

Chapter 14 · Autoencoders

9 of 9 sections available as interactive modules.

14.1 · pp. 503–504

Undercomplete Autoencoders

Explain what an autoencoder is, why a code narrower than the input forces it to keep the most important structure, how a linear undercomplete autoencoder recovers the principal direction of the data, and why too much capacity lets it copy without learning anything.

A copy machine with a bottleneckThe reconstruction lossLinear decoders and PCAToo much capacity: the memorizer
About 30 min
14.2 · pp. 504–508

Regularized Autoencoders

Explain how a penalty on the code, a corrupted input, or the slope of the code can keep an autoencoder useful even when its code is as wide as its input, and check each idea with an interactive demo.

Regularization instead of a small codeSparse AutoencodersDenoising AutoencodersRegularizing by Penalizing Derivatives
About 40 min
14.3 · pp. 508–509

Representational Power, Layer Size and Depth

Explain why an autoencoder can gain from a deep encoder and decoder, what one hidden layer can and cannot enforce, and how a stack of shallow autoencoders is trained, with interactive demos for each idea.

One hidden layer, many unitsFolding the input: depth and costStacking shallow autoencodersWhich claims the book supports
About 25 min
14.4 · pp. 509–510

Stochastic Encoders and Decoders

Explain how the decoder of an autoencoder can be a probability distribution, how the output unit follows the noise model, and how encoders and decoders can be stochastic, with demos for each idea.

The decoder is a distributionBinary and discrete outputsStochastic encodersA stochastic autoencoder
About 30 min
14.5 · pp. 510–515

Denoising Autoencoders

Explain how a denoising autoencoder learns to undo corruption, how its reconstruction becomes a vector field that estimates a score, and what a fixed noise level does to the distribution it learns, with interactive demos for each idea.

Corrupt, then reconstructLearning a vector fieldA short historyFixed noise blurs the distribution
About 40 min
14.6 · pp. 515–520

Learning Manifolds with Autoencoders

Explain why data concentrate near a manifold, what a tangent measures, how a reconstruction that is flat around its data learns the shape of the manifold, why neighbour-graph methods need many examples, and why translations make manifolds complicated, with an interactive demo for each idea.

Data near a manifoldTangent planesReconstruction flat at the dataNeighbour graphs and local pancakesWhy manifolds grow complicated
About 35 min
14.7 · pp. 521–523

Contractive Autoencoders

Explain the contractive penalty on the encoder Jacobian, what it means for a linear operator to be contractive, how the leading singular vectors read as tangent directions, why saturating sigmoid units shrink the Jacobian, why tied weights block a scale trick, how the penalty relates to denoising, and why deep contractive stacks stay contractive, with an interactive demo for each idea.

Two forces and the Jacobian penaltyContractive linear operatorsTangent directions from singular vectorsSaturating sigmoid unitsTied weights block the scale trickDenoising and contractionDeep contractive stacks
About 40 min
14.8 · pp. 523–524

Predictive Sparse Decomposition

Explain how predictive sparse decomposition trains a fast encoder to predict the codes that a slow sparse search would find, what each term of the cost in Equation 14.19 does, and why training alternates between searching for codes and updating the parameters.

Two ways to get a codeThe cost in Equation 14.19Training by taking turnsDeployment, learned inference and stacking
About 40 min
14.9 · pp. 524–525

Applications of Autoencoders

Explain how autoencoders reduce dimension and support retrieval: why a smaller code helps, how a binary code turns search into a table lookup, and how saturated sigmoid units produce bits that survive noise, with honest toy demos for each idea.

Reducing dimension, the first useWhy smaller codes helpRetrieval with binary codesBits from saturated sigmoids
About 35 min

Chapter 15 · Representation Learning

6 of 6 sections available as interactive modules.

15.1 · pp. 528–536

Greedy Layer-Wise Unsupervised Pretraining

Explain how a deep network can be pretrained one layer at a time without labels, why the start point it gives can matter, and why the method faded after 2006 except in language.

A representation that makes the next task easyGreedy, one layer at a timeWhy pretraining helps: priors and featuresWhere the walk ends: the starting pointWhat it costs: two phases, many knobs
About 35 min
15.2 · pp. 536–541

Transfer Learning and Domain Adaptation

Explain when a representation learned for one setting helps another, how the shared part depends on whether inputs or outputs carry the same meaning, and how one-shot and zero-shot learning work through a shared representation.

Sharing the right layersDomain adaptation and a shift in the inputsOne-shot learning: one example per classZero-shot learning through a shared spaceTranslation and paired modalities
About 35 min
15.3 · pp. 541–546

Semi-Supervised Disentangling of Causal Factors

Explain why a representation that separates the causes of the data helps semi-supervised learning, when unlabelled data reveals the classes through p(x), and why a fixed cost such as mean squared error can miss causes that matter.

Causes that the representation separatesWhen p(x) reveals the classesSalience: what the reconstruction error noticesCausal direction and robustness
About 35 min
15.4 · pp. 546–552

Distributed Representation

Explain why a code of many separately set features names far more concepts than one symbol per concept, why that helps a learner generalize, and how many regions a set of linear features can carve.

Many features, many conceptsSymbols and nearest neighboursShared attributes make similar things closeCounting regions with hyperplanesFew parameters, many regionsDirections that mean something
About 35 min
15.5 · pp. 553–554

Exponential Gains from Depth

Count the straight pieces of a folded function, see why a shallow network needs exponentially more units to match it, and state what this result does and does not promise.

Depth as repeated foldingA fold and the shallow alternativeUnits as depth growsOther models and the limits of the result
About 30 min
15.6 · pp. 554–557

Providing Clues to Discover Underlying Causes

Sort the clues that help a learner find underlying causes, from labels and smoothness to sparsity and independence, and test each clue on a small toy.

Labels and priors as cluesSmoothness and linearityCauses, depth and hierarchyShared factors across tasksManifolds, clusters and coherenceSparsity and simple dependencies
About 40 min

Chapter 16 · Structured Probabilistic Models for Deep Learning

7 of 7 sections available as interactive modules.

16.1 · pp. 559–563

The Challenge of Unstructured Modeling

Count how many numbers a lookup table needs for a distribution over many variables, see why the four main tasks need the whole input, and see how keeping only direct links between variables makes the same question cheap.

The size of a lookup tableFour tasks that need the whole inputThe table and its four costsThe relay race keeps only direct linksThe payoff from few direct links
About 25 min
16.2 · pp. 563–580

Using Graphs to Describe Model Structure

Read a graph as a list of direct interactions. Build directed and undirected models from it, count their parameters, compute the normalizing constant, test independence by separation, convert between the two graph languages, and draw factor graphs.

A graph as a list of direct linksDirected models and their arrowsUndirected models and cliquesThe partition functionEnergy-based modelsSeparation and d-separationFrom directed to undirected and backFactor graphs and the summary
About 45 min
16.3 · pp. 580–581

Sampling from Graphical Models

Draw samples from a directed graph by following its arrows, see where that shortcut needs a harder answer, and run Gibbs sampling on a loop of variables that has no first variable.

Sampling a family treeTopological orderAncestral sampling, step by stepWhen the shortcut breaksGibbs sampling around a loopThe cost of a fair sample
About 35 min
16.4 · pp. 582

Advantages of Structured Modeling

Count what a graph saves in numbers, work and sampling steps, read each missing edge as an assumption, and see why keeping structure separate from algorithms lets one method serve many models.

Leaving edges outCheaper representation and inferenceFaster sampling in directed modelsSeparating structure from algorithmsThe assumption behind a missing edge
About 25 min
16.5 · pp. 582–584

Learning about Dependencies

See how hidden variables create dependencies between visible ones, count what it costs to connect everything directly, measure what a search for structure costs, and read a hidden variable as a feature.

Hidden variables carry dependenciesThe cost of connecting everythingThe cost of searching for structureA fixed structure with hidden variablesLatent variables as features
About 35 min
16.6 · pp. 584–585

Inference and Approximate Inference

See what inference asks for, why the identity (16.9) lets maximum likelihood work, why exact inference counts solutions and becomes intractable, and how a variational guess leaves a gap equal to a KL divergence.

What inference asksThe identity behind maximum likelihoodWhy exact inference is hardGuessing the posterior
About 30 min
16.7 · pp. 585–589

The Deep Learning Approach to Structured Probabilistic Models

See how deep learning keeps the tools of graphical models but changes the design choices, then follow one small restricted Boltzmann machine through its energy, its conditionals, its block Gibbs sampling and its derivative.

Same tools, different choicesDepth counted in the graphLayers joined by matricesThe energy of a restricted Boltzmann machineConditionals that factorizeBlock Gibbs samplingDerivatives and learned features
About 35 min

Chapter 17 · Monte Carlo Methods

5 of 5 sections available as interactive modules.

17.1 · pp. 590–592

Sampling and Monte Carlo Methods

Estimate a sum or an integral by averaging samples drawn from a distribution, and read the size of the error from the spread of those samples.

Las Vegas and Monte CarloWhy sampling helpsThe average of samplesError shrinks with the square root of nConfidence intervals and the central limit theoremWhen direct sampling is not possible
About 35 min
17.2 · pp. 592–595

Importance Sampling

Rewrite a sum as an average under a different distribution, weight each sample to correct for the change, and choose that distribution so the estimate stays steady, including when the normalising constant is unknown.

Choosing which part plays the distributionThe importance sampling estimatorVariance and the best proposalBiased importance samplingWhen the weights run wild
About 40 min
17.3 · pp. 595–599

Markov Chain Monte Carlo Methods

Sample a distribution you cannot draw from directly by running a chain of random moves, and check when the chain has settled into the distribution you want.

Why a chain can helpA chain as a transition matrixThe stationary distribution and eigenvaluesBurn-in, mixing time and many chains
About 40 min
17.4 · pp. 599

Gibbs Sampling

Build a Markov chain by updating one variable at a time from its conditional distribution, see why correlated variables slow it down, and find which groups of variables can move together.

One variable at a timeWhy correlation slows the chainBlock Gibbs sampling
About 30 min
17.5 · pp. 599–604

The Challenge of Mixing between Separated Modes

See why a Markov chain can get stuck in one region of a distribution, and try three ways the book describes to help it move between regions: flatten the peaks with tempering, or make the representation deeper.

Slow mixing between modesModes a chain cannot crossTempering to mix between modesDepth may help mixing
About 40 min

Chapter 18 · Confronting the Partition Function

7 of 7 sections available as interactive modules.

18.1 · pp. 605–607

The Log-Likelihood Gradient

Explain why the gradient of an undirected model splits into a positive and a negative phase, derive the gradient of the log partition function, and estimate its negative phase by sampling.

The partition functionPositive and negative phasesDeriving the gradient of log ZEstimating the negative phase by samplingPushing up on data and down on samples
About 35 min
18.2 · pp. 607–614

Stochastic Maximum Likelihood and Contrastive Divergence

Compare the three ways of approximating the negative phase in Algorithms 18.1 to 18.3, see why contrastive divergence misses spurious modes, and explain why persistent chains and fast weights help.

The cost of burning inContrastive divergence starts at the dataStochastic maximum likelihood keeps the chainsFast persistent contrastive divergenceChoosing between the methods
About 45 min
18.3 · pp. 615–617

Pseudolikelihood

Explain why ratios of probabilities avoid the partition function, write the pseudolikelihood and its generalized form, and say where the approximation helps and where it fails.

Ratios hide the normalizerConditionals and the cost of marginalizingThe pseudolikelihood objectiveGeneralized pseudolikelihoodThe negative phase hidden in the denominatorsWhat pseudolikelihood can and cannot do
About 40 min
18.4 · pp. 617–619

Score Matching and Ratio Matching

Explain how score matching trains a model without the partition function, why the data score can be dropped, which models it suits, and how ratio matching handles binary data through neighbouring states.

The score and the vanishing normalizerMatching two scoresAn objective that needs no data scoreWhat score matching can and cannot trainRatio matching for binary dataCost and a random shortcut
About 45 min
18.5 · pp. 619–620

Denoising Score Matching

Explain why a model fitted to a finite sample needs smoothing, derive the denoising target for Gaussian noise, and see how a denoising score matching model learns a density that is wider than the data.

Fitting the training points exactlySmoothing the data with a corruption processThe denoising targetDenoising score matching on a Gaussian modelDenoisers and the score
About 35 min
18.6 · pp. 620–622

Noise-Contrastive Estimation

See how noise-contrastive estimation turns the normaliser into a free constant, trains a classifier between data and noise, and recovers the constant as minus the log partition function.

A normaliser that is a free parameterTurning the problem into a classifierThe logistic form of the classifierWhere the classifier objective peaksChoosing the noise and its limits
About 30 min
18.7 · pp. 623–630

Estimating the Partition Function

Compare two models without computing either partition function, then estimate a ratio of partition functions with importance sampling, annealed importance sampling and bridge sampling, and see where each one breaks.

Comparing two models needs only a ratioSimple importance samplingHow large is the error of the estimateAnnealed importance samplingBridge sampling and training
About 40 min

Chapter 19 · Approximate Inference

5 of 5 sections available as interactive modules.

19.1 · pp. 633–634

Inference as Optimization

Explain why inference is hard in deep models, and show that the evidence lower bound turns inference into an optimization over a guess q. You will be able to rearrange the bound and judge a guess by its gap.

Why inference is hardThe evidence lower boundTwo forms of the boundTighter and looser bounds
About 25 min
19.2 · pp. 634–635

Expectation Maximization

Run the expectation maximization loop on a toy with two hidden clusters, explain why the E-step closes the gap that the M-step opens, and say what each step is allowed to change.

Two steps in a loopThe E-step closes the gapThe M-step and a partial stepEM as coordinate ascent
About 25 min
19.3 · pp. 635–637

MAP Inference and Sparse Coding

Explain the difference between a most likely hidden value and a full posterior, why a point guess gives a loose bound, and how sparse coding with a Laplace prior turns inference into a shrinkage problem you can solve by hand.

The most likely hidden valuePoint guesses and a loose boundSparse coding and its priorThe sparse coding objective
About 30 min
19.4 · pp. 638–650

Variational Inference and Learning

Restrict the approximate posterior to a factorial family, optimize its parameters with fixed point updates, and see how the same bound yields a Gaussian when latent variables are continuous.

Mean field and the direction of KLBinary sparse codingFixed point updatesCalculus of variationsContinuous latent variablesLearning and inference interact
About 50 min
19.5 · pp. 651–653

Learned Approximate Inference

Train a network to do inference directly, using samples from the model in the wake-sleep algorithm, and see where such a network can go wrong when the data differs from the samples it was trained on.

Wake-sleepTraining an inference network from samplesOther learned inference methodsPointer to the variational autoencoder
About 25 min

Chapter 20 · Deep Generative Models

14 of 14 sections available as interactive modules.

20.1 · pp. 654–656

Boltzmann Machines

Explain how a Boltzmann machine assigns a probability to every binary pattern through an energy function, why hidden units add power, why learning uses the difference between two sets of statistics, and why the partition function is the obstacle.

The big pictureEnergy and probabilityHidden unitsLearning by maximum likelihoodThe partition function obstacle
About 35 min
20.2 · pp. 656–660

Restricted Boltzmann Machines

Explain why a restricted Boltzmann machine keeps its two layers apart, why that makes the hidden units independent given the visible units and the reverse, and how block Gibbs sampling draws from a model whose total probability cannot be computed exactly.

Two layers with no links insideThe bipartite graph and the energyConditional distributionsTraining with sampling
About 40 min
20.3 · pp. 660–662

Deep Belief Networks

Explain how a deep belief network stacks RBMs with directed links below a top undirected pair, how it is sampled and trained one layer at a time, and how its weights become a feed-forward network for classification.

Stacked layers with two kinds of linkConditionals and samplingGreedy layer-wise trainingFine-tuning as an MLP
About 35 min
20.4 · pp. 663–676

Deep Boltzmann Machines

Explain how a deep Boltzmann machine stacks undirected layers, why its posterior needs mean-field fixed points, how variational stochastic maximum likelihood and layer-wise pretraining train it, and how joint training with centering and multi-prediction avoids pretraining.

Undirected layers with no links insideBipartite structure and Gibbs samplingMean-field inferenceLearning, pretraining and joint training
About 45 min
20.5 · pp. 676–683

Boltzmann Machines for Real-Valued Data

Explain how Gaussian-Bernoulli RBMs model real-valued data through a conditional mean, why covariance models such as mcRBM, mPoT and the spike and slab RBM capture pixel relationships, and what each costs in sampling and in positive definiteness.

Gaussian-Bernoulli RBMsConditional covariance with mcRBM and mPoTThe spike and slab RBMThe cost of covariance
About 40 min
20.6 · pp. 683–685

Convolutional Boltzmann Machines

Explain how convolution makes Boltzmann machines practical for images, why max pooling is costly in an energy model, how probabilistic max pooling keeps only n + 1 states per pooling region, and where the approach limits overlap, boundaries and input size.

Why pooling is costly in an energy modelProbabilistic max poolingOverlapping pooling regionsBoundaries and input size
About 30 min
20.7 · pp. 685–686

Boltzmann Machines for Structured or Sequential Outputs

Explain how a Boltzmann machine becomes a conditional model for structured outputs and for sequences, how the conditional RBM of Taylor et al. makes its visible bias depend on the past, and how the RNN-RBM lets a recurrent network emit every RBM parameter and is trained through contrastive divergence and back-propagation through time.

Conditioning on structured outputsA conditional RBM over timeBiases or all parametersTraining the RNN-RBM
About 30 min
20.8 · pp. 686–687

Other Boltzmann Machines

Explain how Boltzmann machines can be trained with a discriminative criterion, how most models use second-order energy terms while higher-order terms add masks, class interactions and gating, and why designing a new Boltzmann machine needs an energy function that keeps every conditional tractable.

Training criteriaHigher-order interactionsClass interactions and gatingAn open design space
About 30 min
20.9 · pp. 687–692

Back-Propagation through Random Operations

Explain how gradients pass through a random draw: the reparametrization trick for continuous samples, REINFORCE for discrete ones, and baselines that cut the variance of the estimate without biasing it.

A sample is not a functionReparametrizing a GaussianAny distribution as a function of noiseDiscrete samples and step functionsREINFORCE estimates the gradientBaselines reduce the varianceThe optimal baseline and variance normalization
About 40 min
20.10 · pp. 692–710

Directed Generative Nets

Explain how directed generative networks produce samples, how a generator turns noise into data, how variational autoencoders, GANs and moment matching train such generators, and how auto-regressive models such as NADE factor a joint distribution one variable at a time.

Sigmoid belief networksDifferentiable generator networksThe variational lower boundLatent coordinates and importance weightingGenerative adversarial networksMoment matching and maximum mean discrepancyConvolutional generators and un-poolingThe chain rule and linear auto-regressive networksNeural auto-regressive networks and NADE
About 45 min
20.11 · pp. 711–714

Drawing Samples from Autoencoders

Run the Markov chain of a denoising autoencoder, sample a conditional distribution by clamping some units, and see why walk-back training starts its walks at training examples.

Autoencoders that can already sampleThe Markov chain of a denoising autoencoderClamping and conditional samplingWalk-back training procedure
About 35 min
20.12 · pp. 714–716

Generative Stochastic Networks

Build a generative chain from a latent state and a visible state, check when its spread settles with a linear toy, train it on the clamped reconstruction log-probability, and see how a discriminant variant reuses the same chain.

The latent state in the chainTwo conditionals and their stationary spreadReconstruction log-probability criterionDiscriminant GSNs
About 30 min
20.13 · pp. 716–717

Other Generation Schemes

Build a generative model by reversing a diffusion one small step at a time, see why one step is easier to learn than the full way back, and sample by rejecting candidates until a summary of them matches its target.

Destroying structure with diffusionUndoing one step of diffusionApproximate Bayesian computation
About 25 min
20.14 · pp. 717–720

Evaluating Generative Models

Find out why a generative score can mislead: units, binarization, a background variance that games the likelihood, the direction of the KL divergence, and copies that pass a coverage check.

Scores that move with the unitsBinarization changes the numberA likelihood that rewards constant pixelsForward and reverse KLCopies, missing modes and nearest neighbours
About 40 min

The lessons follow Deep Learning by Ian Goodfellow, Yoshua Bengio and Aaron Courville (MIT Press, 2016), which is free to read at deeplearningbook.org. All explanations, demos and questions on these pages were written by Mathalyse Research.