Blame

0ad9b6 lugonthier 2026-07-10 12:03:30
Remove "07 Regularization and high-dimensional inference" chapter and add "07 Support Vector Machines" and "08 Decision trees and ensemble methods" chapters with corresponding images.
1
# 6. Multilayer neural networks
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
2
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
3
A single linear unit only draws a straight boundary. Stacking many simple units with a nonlinearity between them gives a multilayer neural network, which fits curved boundaries and learns its own features. This module builds that model the gentle way: take the logistic regression of the previous module, draw it as a graph, and make it deep, one step at a time. The recipe is the one every module has used: a model (layers, run by forward propagation), a loss function matched to the task, and gradient descent, now powered by backpropagation. The story then continues the way practice forced it to: gradients vanish in deep stacks, better activations revive them, good practices make training behave, and gradient descent itself gets an upgrade. This module is the gateway to the [Deep Learning](/en/Deep%20Learning) course, which develops every topic here in depth.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
4
0ad9b6 lugonthier 2026-07-10 12:03:30
Remove "07 Regularization and high-dimensional inference" chapter and add "07 Support Vector Machines" and "08 Decision trees and ensemble methods" chapters with corresponding images.
5
## 6.1 Linear versus nonlinear
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
6
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
7
The linear classifiers of the [linear classification module](/en/Machine%20Learning/05%20Linear%20classification) separate classes with a single straight boundary, so a problem like XOR, which is not linearly separable, is out of reach. Bending the boundary takes something nonlinear, and the whole question is where the nonlinearity comes from. [Linear regression](/en/Machine%20Learning/04%20Linear%20regression) answered it once already, with basis functions $\phi$ fixed by hand before training. Networks answer it differently: they learn the features themselves. The next section builds that machine out of a model already in hand.
8
9
## 6.2 Make logistic regression deep
10
11
### 6.2.1 Logistic regression as a network
12
13
[Linear classification](/en/Machine%20Learning/05%20Linear%20classification) ended with logistic regression: a dot product with the weights $w$ and a sigmoid that squashes the score into a probability,
14
15
$$\boxed{ \hat{y} = \sigma(w^T x) }$$
16
17
with the course's usual convention that $x$ is augmented with a constant $x_0 = 1$, so the weight $w_0$ is the bias. Drawn as a graph, this is already a network, the smallest possible one. The input layer holds $x$, its constant included, and computes nothing. A single output neuron does all the work: multiply by the weights, apply the activation. Every neuron in this module is exactly this unit.
18
19
![Logistic regression drawn as a network](/en/Machine%20Learning/06%20Multilayer%20neural%20networks/a/logreg-network.svg)
20
21
*Each edge carries one weight and the neuron applies $\sigma$ to the weighted sum. The neuron fixed at $1$ carries the bias: its weight is $w_0$.*
22
23
*Remark:* the bias stays folded into the weights throughout this module, drawn as a constant neuron. The [Deep Learning](/en/Deep%20Learning) course instead keeps an explicit bias vector $b^{[l]}$, and flags the change of convention when it introduces it.
24
25
### 6.2.2 Insert a hidden layer
26
27
Nothing forces the output neuron to read the raw input. Insert a few neurons between the input and the output, say three. Each one is the same dot-product unit as always, with its own weights $w_i$ and a nonlinear activation $g$:
28
29
$$a_i = g(w_i^T x), \qquad i = 1, 2, 3$$
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
30
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
31
Stack the three weight vectors $w_i^T$ as the rows of a matrix $W^{[1]}$ and the whole layer becomes one line, $a = g(W^{[1]} x)$. The bracketed superscript $[1]$ is new, and it exists for a mundane reason: the model now has two sets of weights, so each needs a name. $[l]$ simply says which layer a symbol belongs to.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
32
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
33
The output neuron has not changed at all. It is still the logistic regression of section 6.2.1, it just reads the three learned values $a$, augmented with a constant $a_0 = 1$ (every layer gets a bias neuron, exactly like the input), instead of the raw input:
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
34
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
35
$$\boxed{ \hat{y} = \sigma\!\left(w^{[2]T} a\right) = \sigma\!\left(w^{[2]T}\, g(W^{[1]} x)\right) }$$
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
36
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
37
![Take logistic regression and insert a hidden layer](/en/Machine%20Learning/06%20Multilayer%20neural%20networks/a/make-it-deep.svg)
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
38
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
39
*The orange output neuron is identical in both drawings. Making the model deep changed what it reads: three learned features $a$ instead of the raw $x$. Each layer carries its own constant neuron $1$, whose outgoing weights are the biases.*
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
40
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
41
Two facts about this insertion carry the whole story.
42
43
**The hidden activation must be nonlinear.** If $g$ were the identity, the two layers would collapse into a single linear map,
44
45
$$\boxed{ W^{[2]}\!\left(W^{[1]} x\right) = W' x }$$
46
47
and depth would add nothing. The nonlinearity is what makes stacking worthwhile, and it is why XOR is now within reach.
48
49
**The hidden layer learns the features.** The output neuron is still a linear classifier, so the hidden layer's job is to move the data somewhere the classes become linearly separable. It plays exactly the role of the basis functions $\phi$ of [Linear regression](/en/Machine%20Learning/04%20Linear%20regression), with one upgrade: $\phi$ was fixed by hand before training, while $a$ is learned from the data, end to end.
50
51
### 6.2.3 How to make a prediction?
52
53
One hidden layer worked, so repeat the move: the vector $a^{[1]}$ can feed a second hidden layer, whose output $a^{[2]}$ can feed a third, until an output layer produces $\hat{y}$. Layer $l$ owns its weight matrix $W^{[l]}$ (one row per neuron, so the output layer above had the single row $w^{[2]T}$) and its activation $g^{[l]}$. Width and depth are the capacity dials: more units and more layers mean more parameters and more expressive boundaries, and, as [General concepts](/en/Machine%20Learning/02%20General%20concepts) warned, more room to overfit.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
54
0ad9b6 lugonthier 2026-07-10 12:03:30
Remove "07 Regularization and high-dimensional inference" chapter and add "07 Support Vector Machines" and "08 Decision trees and ensemble methods" chapters with corresponding images.
55
![Input, hidden, and output layers](/en/Machine%20Learning/06%20Multilayer%20neural%20networks/a/mlp-layers.svg)
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
56
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
57
*Each edge carries a weight in $W^{[l]}$. The constant bias neurons are left out of the drawing.*
58
59
Computing the prediction by reading the network left to right is called forward propagation, and the general formula only restates what the last two sections built, once per layer:
60
61
$$\boxed{ z^{[l]} = W^{[l]} a^{[l-1]}, \quad a^{[l]} = g^{[l]}\!\left(z^{[l]}\right), \quad a^{[0]} = x, \quad \hat{y} = a^{[L]} }$$
62
63
with one convention to remember: every $a^{[l]}$, like the input, is read with its bias neuron $a^{[l]}_0 = 1$ prepended. In vectorized form the whole mini-batch flows at once, one matrix operation per layer with the examples as columns, which is both clearer and far faster:
64
65
$$\boxed{ Z^{[l]} = W^{[l]} A^{[l-1]} }$$
66
67
Forward propagation is the first half of every training step. The second half, backpropagation, runs the same wiring in reverse (section 6.4).
68
69
### 6.2.4 The formula on the graph
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
70
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
71
Every symbol in the forward propagation formula lives somewhere on the network drawing. The figure below places each one on the smallest interesting network, two inputs, one hidden layer of two units, and one output:
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
72
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
73
![Every term of forward propagation placed on the network](/en/Machine%20Learning/06%20Multilayer%20neural%20networks/a/forward-notation.svg)
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
74
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
75
*Left: the superscript $[l]$ names the layer, each edge carries one weight $w^{[l]}_{ij}$, and the neurons fixed at $1$ carry the biases $w^{[l]}_{i0}$. Right: inside a unit, the weighted sum gives $z^{[l]}_i$, then the activation $g$ turns it into $a^{[l]}_i$.*
76
77
| Symbol | Name | Where it lives on the graph |
78
| --- | --- | --- |
79
| $l$, $L$ | layer index, number of layers | which column of units ($l = 0$ is the input, here $L = 2$) |
80
| $x = a^{[0]}$ | the input | the leftmost column |
81
| $w^{[l]}_{ij}$ | one weight | the number carried by one edge: into unit $i$ of layer $l$, from unit $j$ of layer $l-1$ |
82
| $W^{[l]}$ | weight matrix of layer $l$ | all the edges arriving into layer $l$, one row per unit |
83
| $x_0$, $a^{[l]}_0$ | bias neuron | a unit fixed at $1$ in each layer, whose outgoing weight $w^{[l]}_{i0}$ is the bias of unit $i$ |
84
| $z^{[l]}_i$ | pre-activation | the weighted sum the unit computes before applying $g$ |
85
| $g^{[l]}$ | activation function | applied inside every unit of layer $l$ |
86
| $a^{[l]}_i$ | activation | the value the unit sends along its outgoing edges |
87
| $\hat{y} = a^{[L]}$ | the prediction | what leaves the last layer |
88
89
Now run this exact network with numbers. Take $x = (1, 2)$, augmented to $(1, 1, 2)$ by the bias neuron $x_0 = 1$, the sigmoid of the previous module as the activation everywhere, with
90
91
$$W^{[1]} = \begin{pmatrix} 0 & 2 & -1 \\ -1 & 1 & 1 \end{pmatrix}, \qquad W^{[2]} = \begin{pmatrix} 0 & 1 & 1 \end{pmatrix}$$
92
93
Row $i$ of $W^{[1]}$ collects the weights of the edges arriving into hidden unit $i$, bias first. Layer 1, unit by unit:
94
95
$$z^{[1]}_1 = \underbrace{0}_{w^{[1]}_{10}} \cdot \underbrace{1}_{x_0} + \underbrace{2}_{w^{[1]}_{11}} \cdot \underbrace{1}_{x_1} + \underbrace{(-1)}_{w^{[1]}_{12}} \cdot \underbrace{2}_{x_2} = 0, \qquad a^{[1]}_1 = \sigma(0) = 0.5$$
96
97
$$z^{[1]}_2 = -1 \cdot 1 + 1 \cdot 1 + 1 \cdot 2 = 2, \qquad a^{[1]}_2 = \sigma(2) \approx 0.88$$
98
99
Hidden unit 1 lands exactly on zero, the midpoint of the sigmoid, so it outputs $0.5$, while unit 2 sits high on the curve. The output layer repeats the same two steps, now reading $a^{[1]} = (0.5, 0.88)$, augmented to $(1, 0.5, 0.88)$ by its own bias neuron, instead of $x$:
100
101
$$z^{[2]} = 0 \cdot 1 + 1 \cdot 0.5 + 1 \cdot 0.88 = 1.38, \qquad \hat{y} = a^{[2]} = \sigma(1.38) \approx 0.80$$
102
103
The network predicts class 1 with probability about $0.80$. That is all forward propagation does: multiply by the edge weights, bias neuron included, apply the activation, at every unit of every layer.
104
105
## 6.3 The loss function
106
107
The network's body is task-agnostic. The task lives in the last layer: its activation shapes $\hat{y}$, and the loss compares $\hat{y}$ to the label, reusing the losses of [General concepts](/en/Machine%20Learning/02%20General%20concepts) and [Linear classification](/en/Machine%20Learning/05%20Linear%20classification):
108
109
| Task | Output activation | Loss function |
110
| --- | --- | --- |
111
| regression | identity | squared error |
112
| binary classification | sigmoid | binary cross-entropy |
113
| multiclass classification | softmax | categorical cross-entropy |
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
114
115
$$\boxed{ \hat{y} = \frac{1}{1 + e^{-z}} \quad\text{(binary)} \qquad \hat{y}_c = \frac{e^{z_c}}{\sum_{j} e^{z_j}} \quad\text{(multiclass)} }$$
116
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
117
*Remark:* these are exactly the neuron heads of [Linear classification](/en/Machine%20Learning/05%20Linear%20classification). A network is that same head with learned features underneath instead of raw inputs.
118
119
## 6.4 How to optimize the parameters?
120
121
Nothing here is new either: training a network follows the same steps as every model of this course, so let us walk them in order.
122
123
**Step 0: pose the objective.** Find the weights that minimize the loss plus a regularizer that keeps them small, the maximum a posteriori recipe of [Linear regression](/en/Machine%20Learning/04%20Linear%20regression):
124
125
$$\boxed{ W^\star = \arg\min_W \; L(W) + \lambda\, R(W), \qquad R(W) = \lVert W \rVert_1 \;\text{ or }\; \lVert W \rVert_2^2 }$$
126
127
**Step 1: choose the loss.** That is section 6.3, and its table carries the warning that comes with it: the loss and the output activation are picked as a pair. Cross-entropy calls for a softmax (or a sigmoid), squared error for an identity output.
128
129
**Step 2: descend the gradient.** Update every weight by a small step against its gradient, with learning rate $\alpha$, exactly the gradient descent of [Linear classification](/en/Machine%20Learning/05%20Linear%20classification):
130
131
$$\boxed{ w^{[l]}_{ij} \leftarrow w^{[l]}_{ij} - \alpha\, \frac{\partial \left(L + \lambda R\right)}{\partial w^{[l]}_{ij}} }$$
132
133
**Step 3: get the gradient by backpropagation.** The genuinely new piece is computing that gradient for every weight in a stack of layers. Backpropagation does it with the chain rule, in one forward and one backward sweep: forward propagation caches each $z^{[l]}$ and $a^{[l]}$, then the backward pass propagates the loss gradient layer by layer, from the output back to the first layer, reusing the cache. With the layer error $\delta^{[l]} = \partial L / \partial z^{[l]}$,
134
135
$$\boxed{ \delta^{[l]} = \left((W^{[l+1]})^T \delta^{[l+1]}\right) \odot g'^{[l]}\!\left(z^{[l]}\right), \qquad \frac{\partial L}{\partial W^{[l]}} = \delta^{[l]} (a^{[l-1]})^T }$$
136
137
The bias neurons fit for free: being constant, they receive no error (their row of $(W^{[l+1]})^T \delta^{[l+1]}$ is simply dropped), and since $a^{[l-1]}$ includes the constant $1$, the same outer product delivers the bias gradients along with the rest.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
138
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
139
![Forward and backward passes](/en/Machine%20Learning/06%20Multilayer%20neural%20networks/a/backprop.svg)
140
141
*Forward propagation computes and caches the activations, backpropagation sends the loss gradient back through the same edges. The [Backpropagation](/en/Deep%20Learning/05%20Backpropagation) lesson of the Deep Learning course derives it step by step.*
142
143
<details class="proof">
144
<summary>Full example: one gradient descent step on the tiny network</summary>
145
146
Pick up the network of section 6.2.4 exactly where forward propagation left it: $\bar{x} = (1, 1, 2)$, $a^{[1]} = (0.5,\ 0.88)$, $\hat{y} = 0.80$, and give the example a label: the true class is $y = 0$. Take the binary cross-entropy of section 6.3 with no regularization ($\lambda = 0$), so the loss is
147
148
$$L = -\ln(1 - \hat{y}) = -\ln(0.20) \approx 1.61$$
149
150
The network is confidently wrong, and the gradient is about to say so.
151
152
**Backward through the output layer.** For a sigmoid output trained with cross-entropy, the output error collapses to the familiar $\hat{y} - y$ of [Linear classification](/en/Machine%20Learning/05%20Linear%20classification):
153
154
$$\delta^{[2]} = \hat{y} - y = 0.80$$
155
156
Each weight of $W^{[2]}$ receives $\delta^{[2]}$ times the activation it reads (the outer-product formula, bias neuron included):
157
158
$$\frac{\partial L}{\partial W^{[2]}} = \delta^{[2]} \left(\bar{a}^{[1]}\right)^T = 0.80 \cdot (1,\ 0.5,\ 0.88) = (0.80,\ 0.40,\ 0.70)$$
159
160
**Backward through the hidden layer.** Each hidden unit takes its share of the error through its outgoing weight, times its own slope $\sigma'(z) = \sigma(z)(1 - \sigma(z))$:
161
162
$$\delta^{[1]}_1 = w^{[2]}_{11}\, \delta^{[2]}\, \sigma'(0) = 1 \cdot 0.80 \cdot 0.25 = 0.20, \qquad \delta^{[1]}_2 = 1 \cdot 0.80 \cdot 0.10 = 0.08$$
163
164
(the constant bias neuron takes no error, and note the small slope $0.10$ of unit 2: section 6.5 returns to it). Then the same outer product against $\bar{x} = (1, 1, 2)$:
165
166
$$\frac{\partial L}{\partial W^{[1]}} = \delta^{[1]}\, \bar{x}^T = \begin{pmatrix} 0.20 & 0.20 & 0.40 \\ 0.08 & 0.08 & 0.16 \end{pmatrix}$$
167
168
**The update.** Step 2 with a deliberately large $\alpha = 1$, so the movement is visible:
169
170
$$W^{[2]} \leftarrow (0,\ 1,\ 1) - (0.80,\ 0.40,\ 0.70) = (-0.80,\ 0.60,\ 0.30)$$
171
172
$$W^{[1]} \leftarrow \begin{pmatrix} 0 & 2 & -1 \\ -1 & 1 & 1 \end{pmatrix} - \begin{pmatrix} 0.20 & 0.20 & 0.40 \\ 0.08 & 0.08 & 0.16 \end{pmatrix} = \begin{pmatrix} -0.20 & 1.80 & -1.40 \\ -1.08 & 0.92 & 0.84 \end{pmatrix}$$
173
174
**Did it help?** Run forward propagation once more with the new weights: $z^{[1]} = (-1.20,\ 1.52)$, $a^{[1]} = (0.23,\ 0.82)$, $z^{[2]} = -0.42$, and
175
176
$$\hat{y} = \sigma(-0.42) \approx 0.40, \qquad L = -\ln(1 - 0.40) \approx 0.51$$
177
178
One step, and the prediction for class 1 fell from $0.80$ to $0.40$, the loss from $1.61$ to $0.51$. Training is this loop, repeated over mini-batches until the loss settles.
179
180
</details>
181
182
## 6.5 The vanishing gradient
183
184
The backpropagation formula hides a trap. Every layer the error crosses multiplies $\delta^{[l]}$ by the local slope $g'(z^{[l]})$, so the gradient reaching layer 1 contains one such factor per layer. With sigmoid activations those factors are small by construction:
185
186
$$\boxed{ \sigma'(z) = \sigma(z)\left(1 - \sigma(z)\right) \le \tfrac{1}{4} }$$
187
188
The result is the vanishing gradient: the layers near the output learn, the layers near the input receive almost nothing and barely move. Deep sigmoid networks stall, and the fix is not a better optimizer, it is a better activation (section 6.6).
189
190
<details class="proof">
191
<summary>Proof: the gradient shrinks geometrically with depth</summary>
192
193
**Step 1: the sigmoid's slope never exceeds $1/4$.** Differentiate $\sigma(z) = (1 + e^{-z})^{-1}$ with the chain rule:
194
195
$$\sigma'(z) = \frac{e^{-z}}{\left(1 + e^{-z}\right)^2} = \frac{1}{1 + e^{-z}} \cdot \frac{e^{-z}}{1 + e^{-z}} = \sigma(z)\left(1 - \sigma(z)\right)$$
196
197
Write $s = \sigma(z) \in (0, 1)$. The product $s(1 - s)$ is a downward parabola in $s$, largest at $s = \tfrac{1}{2}$ where it equals $\tfrac{1}{4}$. So the bound holds, with equality only at $z = 0$, and saturation makes it far worse: in the worked example of section 6.2.4, hidden unit 2 sits at $\sigma(2) \approx 0.88$, where the slope has already dropped to $0.88 \cdot 0.12 \approx 0.10$.
198
199
**Step 2: backpropagation multiplies those slopes.** Take the simplest deep network, a chain of $L$ layers with one unit each, so every quantity is a scalar. Applying the chain rule from the output back to layer 1, each layer crossed contributes the factor $\partial z^{[l]} / \partial z^{[l-1]} = w^{[l]}\, \sigma'(z^{[l-1]})$:
200
201
$$\frac{\partial L}{\partial z^{[1]}} = \frac{\partial L}{\partial z^{[L]}} \prod_{l=2}^{L} w^{[l]}\, \sigma'(z^{[l-1]})$$
202
203
With weights of typical size $|w^{[l]}| \le 1$, every factor is at most $\tfrac{1}{4}$ in absolute value, so
204
205
$$\boxed{ \left|\frac{\partial L}{\partial z^{[1]}}\right| \le \left(\tfrac{1}{4}\right)^{L-1} \left|\frac{\partial L}{\partial z^{[L]}}\right| }$$
206
207
Ten layers already shrink the gradient by about $10^{-6}$. The full matrix case is the recursion of section 6.4, with the same conclusion. $\blacksquare$
208
209
</details>
210
211
Weights much larger than $1$ only trade the problem for its mirror image, the exploding gradient. The [Initialization and vanishing gradients](/en/Deep%20Learning/07%20Initialization%20and%20vanishing%20gradients) lesson of the Deep Learning course gives the full treatment.
212
213
## 6.6 Activation functions
214
215
So which activation should $g$ be? The candidates, in the order history tried them:
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
216
217
$$\boxed{ \sigma(z) = \frac{1}{1 + e^{-z}}, \qquad \tanh(z), \qquad \mathrm{ReLU}(z) = \max(0, z) }$$
218
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
219
The sigmoid saturates in both tails, which is exactly what section 6.5 punished, and its outputs are never negative, so a unit's incoming weights all receive gradients of the same sign and the updates zig-zag. The zero-centered $\tanh$ removes that bias but still saturates. ReLU keeps a slope of exactly $1$ on its whole positive side, so the shrinking factors of section 6.5 disappear, and it costs almost nothing to compute. That is why it is the default hidden activation today.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
220
0ad9b6 lugonthier 2026-07-10 12:03:30
Remove "07 Regularization and high-dimensional inference" chapter and add "07 Support Vector Machines" and "08 Decision trees and ensemble methods" chapters with corresponding images.
221
![Activation functions](/en/Machine%20Learning/06%20Multilayer%20neural%20networks/a/activations.png)
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
222
223
*The tanh is zero-centered while the sigmoid is not, and ReLU stays linear for positive inputs.*
224
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
225
ReLU has one blind spot: a unit whose input stays negative outputs $0$, has slope $0$, and stops learning, a dead unit. Variants such as Leaky ReLU, $\max(0.01 z, z)$, and ELU keep a small slope on the negative side to prevent it. In practice: start with ReLU, try its variants if units die, and keep the sigmoid only where section 6.3 needs it, at the output of a binary classifier. The [Activation functions](/en/Deep%20Learning/03%20Activation%20functions) lesson of the Deep Learning course compares them all.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
226
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
227
## 6.7 Good practices
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
228
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
229
Five habits make the difference between a network that trains and one that stalls.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
230
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
231
**Train on mini-batches.** [Linear classification](/en/Machine%20Learning/05%20Linear%20classification) offered two extremes, the full batch or a single example per step. Networks train on mini-batches, a small batch per step: a gradient accurate enough to make progress, a step cheap enough to take thousands of them, and the vectorized forward propagation of section 6.2.3 processes the whole mini-batch in one matrix product per layer.
232
233
**Initialize with care.** Equal weights would make every unit of a layer compute the same thing forever, so start small and random to break the symmetry. The scale matters too: too small and the activations shrink toward zero layer after layer, too large and they saturate. Scale the variance by the unit's number of inputs, Xavier for tanh, He for ReLU.
234
235
**Center and normalize the inputs.** Standardize each feature (subtract its mean, divide by its standard deviation), so no feature dominates the first dot products and the all-positive-input zig-zag of section 6.6 disappears at the first layer.
236
237
**Dropout.** Randomly zero a fraction of units during training so none can lean on its neighbors, a regularizer in the spirit of [General concepts](/en/Machine%20Learning/02%20General%20concepts). At prediction time every unit stays on and outputs are scaled by the keep probability, which approximates averaging the many thinned networks ([Regularization and dropout](/en/Deep%20Learning/09%20Regularization%20and%20dropout)).
238
239
**Sanity-check before training long.** A freshly initialized $K$-class classifier should start near the loss $\ln K$ (about $2.3$ for $K = 10$). A tiny training set should be easy to overfit: if the network cannot, the code is broken. Watch the training and validation curves. And since backpropagation is error-prone, check its analytic gradient against a numerical finite-difference estimate:
240
241
$$\boxed{ \frac{\partial L}{\partial w} \approx \frac{L(w + \varepsilon) - L(w - \varepsilon)}{2\varepsilon} }$$
242
243
## 6.8 Gradient descent, improved
244
245
Plain gradient descent takes the steepest step and nothing more, and three landscapes defeat it: plateaus, where the slope is nearly zero and progress stalls, saddle points (common in high dimension), where the gradient is exactly zero without being a minimum, and ravines, steep in one direction and shallow in another, where the step oscillates across the walls while crawling along the floor.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
246
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
247
**Momentum** treats the update as a velocity with friction: gradients accumulate, persistent directions build up speed, oscillating ones cancel out:
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
248
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
249
$$\boxed{ v \leftarrow \rho\, v + \nabla_W L, \qquad W \leftarrow W - \alpha\, v }$$
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
250
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
251
with the friction $\rho$ typically around $0.9$.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
252
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
253
**RMSProp** gives each parameter its own step size, dividing by a running average of the gradient's magnitude, so steep directions are tamed and flat ones sped up:
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
254
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
255
$$\boxed{ m \leftarrow \beta\, m + (1 - \beta) \left(\nabla_W L\right)^2, \qquad W \leftarrow W - \frac{\alpha}{\sqrt{m} + \varepsilon}\, \nabla_W L }$$
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
256
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
257
**Adam** combines the two ideas, a velocity for the direction and a per-parameter scale for the step (the full version also corrects a startup bias in $v$ and $m$), and is the default optimizer in practice:
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
258
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
259
$$\boxed{ v \leftarrow \beta_1 v + (1 - \beta_1)\, \nabla_W L, \qquad m \leftarrow \beta_2 m + (1 - \beta_2) \left(\nabla_W L\right)^2, \qquad W \leftarrow W - \alpha\, \frac{v}{\sqrt{m} + \varepsilon} }$$
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
260
6b31d5 lugonthier 2026-07-15 12:37:13
feat: Update "Decision trees and ensemble methods" module with new content and visuals - Revamped the introduction to ensemble methods, emphasizing the benefits of combining models. - Expanded sections on decision trees, bagging, and boosting, including detailed explanations and formulas. - Added new SVG diagrams illustrating the bagging process, the transition from stumps to trees, and variance reduction. - Introduced new images for AdaBoost rounds and variance reduction to enhance understanding.
261
Two habits complete the picture: decay the learning rate as training advances, and remember that all three methods still consume the mini-batch gradients of section 6.7, they only spend them more wisely. The [Optimization](/en/Deep%20Learning/06%20Optimization) lesson of the Deep Learning course derives each one and adds the learning-rate schedules.
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
262
a3ddd0 lugonthier 2026-07-02 17:23:32
Refactor Machine Learning module structure and content - Swapped the order of "Réseaux de neurones multi-couches" and "Régularisation et inférence en grande dimension" in the main Machine Learning index. - Updated references in "Régression linéaire" to point to the correct module for regularization. - Changed the next module reference in "Classification linéaire" to "Régularisation et inférence en grande dimension". - Added new module "Régularisation et inférence en grande dimension" with detailed explanations of ridge and lasso regression, including their mathematical formulations and implications for model selection. - Included visual aids for L1 and L2 regularization paths. - Introduced new module "Réseaux de neurones multi-couches" covering the architecture and training of multi-layer neural networks, emphasizing the importance of non-linearity and activation functions. - Added visual representations for neural network layers and backpropagation process.
263
*This module is the doorway to the [Deep Learning](/en/Deep%20Learning) course, which develops architectures, optimizers, initialization, normalization, and regularization in full. The next module returns to linear models from a new angle, the maximum-margin classifier.*
17beab lugonthier 2026-07-02 16:43:49
Add French translations for Regularization, Support Vector Machines, and Decision Trees modules - Created "08 Regularization and high-dimensional inference.md" with detailed explanations on regularization techniques including ridge, lasso, and elastic net. - Added images for L1 and L2 geometry and regularization path. - Created "09 Support Vector Machines.md" covering SVM concepts, including margin, loss functions, kernels, and duality. - Added images for SVM margin and kernel decision boundaries. - Created "10 Decision trees and ensemble methods.md" explaining decision trees, random forests, and boosting techniques. - Added images for decision tree boundaries and forest vs tree comparison.
264
265
---
0ad9b6 lugonthier 2026-07-10 12:03:30
Remove "07 Regularization and high-dimensional inference" chapter and add "07 Support Vector Machines" and "08 Decision trees and ensemble methods" chapters with corresponding images.
266
Next: [Support Vector Machines](/en/Machine%20Learning/07%20Support%20Vector%20Machines) · [Course overview](/en/Machine%20Learning)