Commit a3ddd0

2026-07-02 17:23:32 lugonthier: 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.
en/Machine Learning.md ..
@@ 12,8 12,8 @@
4. [Probabilistic formulation](/en/Machine%20Learning/04%20Probabilistic%20formulation)
5. [Linear regression](/en/Machine%20Learning/05%20Linear%20regression)
6. [Linear classification](/en/Machine%20Learning/06%20Linear%20classification)
- 7. [Multilayer neural networks](/en/Machine%20Learning/07%20Multilayer%20neural%20networks)
- 8. [Regularization and high-dimensional inference](/en/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference)
+ 7. [Regularization and high-dimensional inference](/en/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference)
+ 8. [Multilayer neural networks](/en/Machine%20Learning/08%20Multilayer%20neural%20networks)
9. [Support Vector Machines](/en/Machine%20Learning/09%20Support%20Vector%20Machines)
10. [Decision trees and ensemble methods](/en/Machine%20Learning/10%20Decision%20trees%20and%20ensemble%20methods)
en/Machine Learning/05 Linear regression.md ..
@@ 54,7 54,7 @@
This is regularized (ridge) regression: the Gaussian prior becomes an L2 penalty, exactly the prior-to-penalty link noted in the previous module.
- *Remark:* a stronger prior (small $\tau$) means a larger $\lambda$ and more shrinkage toward zero. With abundant data the likelihood dominates the prior and the maximum-a-posteriori fit approaches the maximum-likelihood one. Choosing the degree $d$ and the penalty $\lambda$ is a model-selection problem, settled by cross-validation from the [evaluation module](/en/Machine%20Learning/03%20Model%20evaluation%20and%20validation), and taken further in the [regularization module](/en/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference).
+ *Remark:* a stronger prior (small $\tau$) means a larger $\lambda$ and more shrinkage toward zero. With abundant data the likelihood dominates the prior and the maximum-a-posteriori fit approaches the maximum-likelihood one. Choosing the degree $d$ and the penalty $\lambda$ is a model-selection problem, settled by cross-validation from the [evaluation module](/en/Machine%20Learning/03%20Model%20evaluation%20and%20validation), and taken further in the [regularization module](/en/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference).
*The same linear score, passed through a squashing function instead of read directly, turns regression into classification, the subject of the next module.*
en/Machine Learning/06 Linear classification.md ..
@@ 80,4 80,4 @@
*With linear models covered, the next module controls their complexity: regularization and inference when the regressors are many.*
---
- Next: [Multilayer neural networks](/en/Machine%20Learning/07%20Multilayer%20neural%20networks) · [Course overview](/en/Machine%20Learning)
+ Next: [Regularization and high-dimensional inference](/en/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference) · [Course overview](/en/Machine%20Learning)
en/Machine Learning/08 Regularization and high-dimensional inference.md .. en/Machine Learning/07 Regularization and high-dimensional inference.md
@@ 1,4 1,4 @@
- # 8. Regularization and high-dimensional inference
+ # 7. Regularization and high-dimensional inference
You often do not have a handful of clean regressors. There can be many candidate predictors, sometimes more than observations, and they are correlated. Ordinary least squares overfits or breaks down in that regime. Regularization tames it by shrinking the coefficients, and this is where regularized regression meets classical statistics most directly. It also carries a warning: selecting variables and then doing inference on the same data invalidates the classical standard errors, which matters whenever the goal is a causal estimate rather than a prediction.
@@ 11,11 11,11 @@
- Choose the penalty $\lambda$ by cross-validation.
- Recognize why naive post-selection inference is invalid, and know the standard corrections.
- ## 8.1 Why regularize
+ ## 7.1 Why regularize
When the number of regressors $p$ is large relative to the sample size $n$, the least-squares fit chases noise and its coefficients have huge variance. With correlated regressors the matrix $X^T X$ is nearly singular, so small data changes swing the estimates wildly, and when $p > n$ it is singular and OLS has no unique solution at all. Regularization accepts a little bias in exchange for a large cut in variance, the trade-off from [General concepts](/en/Machine%20Learning/02%20General%20concepts).
- ## 8.2 Ridge regression (L2)
+ ## 7.2 Ridge regression (L2)
Ridge adds a squared-norm penalty on the coefficients to the least-squares objective:
@@ 27,7 27,7 @@
Ridge shrinks all coefficients smoothly toward zero but never sets them exactly to zero, so it stabilizes rather than selects.
- ## 8.3 Lasso regression (L1)
+ ## 7.3 Lasso regression (L1)
The lasso replaces the squared penalty with an absolute-value penalty:
@@ 35,17 35,17 @@
This small change has a large consequence: the lasso drives some coefficients to exactly zero, so it performs variable selection while it fits. The reason is geometric. The constraint region $\|\beta\|_1 \le t$ is a diamond with corners on the axes, and the elliptical loss contours tend to first touch it at a corner, where one coordinate is zero.
- ![L1 versus L2 constraint geometry](/en/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference/a/l1-l2-geometry.png)
+ ![L1 versus L2 constraint geometry](/en/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference/a/l1-l2-geometry.png)
*The rounded L2 ball is touched off the axes, keeping every coefficient nonzero, while the L1 diamond is touched at a corner, setting a coefficient to exactly zero.*
As the penalty grows, more coefficients cross to zero, tracing the regularization path from the full model to the empty one.
- ![Lasso regularization path](/en/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference/a/regularization-path.png)
+ ![Lasso regularization path](/en/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference/a/regularization-path.png)
*Each coefficient shrinks as $\lambda$ increases and then hits exactly zero, so the lasso yields a compact, interpretable subset of regressors.*
- ## 8.4 Elastic net
+ ## 7.4 Elastic net
The elastic net blends the two penalties, keeping the lasso's selection while borrowing the ridge's stability with correlated regressors:
@@ 53,11 53,11 @@
with $\alpha \in [0, 1]$ mixing selection ($\alpha = 1$, lasso) and shrinkage ($\alpha = 0$, ridge).
- ## 8.5 Choosing the penalty
+ ## 7.5 Choosing the penalty
The penalty $\lambda$ is a hyperparameter, so it is chosen by cross-validation from the [previous module](/en/Machine%20Learning/03%20Model%20evaluation%20and%20validation): fit over a grid of $\lambda$ values and keep the one with the lowest cross-validated error, or the largest $\lambda$ within one standard error of the best for a simpler model. Larger $\lambda$ means more shrinkage, more bias, and less variance.
- ## 8.6 The inference caveat
+ ## 7.6 The inference caveat
Prediction is not inference, and this is the point that is easy to miss. Suppose you select regressors with the lasso and then run ordinary least squares on the chosen subset and report textbook standard errors. Those standard errors are wrong. They ignore that the data was already used to pick the variables, so the confidence intervals are too narrow and the p-values are not valid, a form of the winner's curse. Three corrections are standard:
@@ 69,7 69,7 @@
*Remark:* these ideas are the doorway to causal machine learning, where flexible learners estimate nuisance functions while a correction preserves valid inference on the parameter of interest. Regularization is superb for prediction, but for a causal parameter you need one of these corrections, not the raw penalized coefficients.
- *With shrinkage and selection covered, the next module takes a different route to a good decision boundary, the maximum-margin classifier, before we turn to trees and ensembles.*
+ *With shrinkage and selection covered, the next module stacks these linear building blocks into multilayer neural networks.*
---
- Next: [Support Vector Machines](/en/Machine%20Learning/09%20Support%20Vector%20Machines) · [Course overview](/en/Machine%20Learning)
+ Next: [Multilayer neural networks](/en/Machine%20Learning/08%20Multilayer%20neural%20networks) · [Course overview](/en/Machine%20Learning)
en/Machine Learning/08 Regularization and high-dimensional inference/l1-l2-geometry.png .. en/Machine Learning/07 Regularization and high-dimensional inference/l1-l2-geometry.png
en/Machine Learning/08 Regularization and high-dimensional inference/regularization-path.png .. en/Machine Learning/07 Regularization and high-dimensional inference/regularization-path.png
en/Machine Learning/07 Multilayer neural networks.md .. en/Machine Learning/08 Multilayer neural networks.md
@@ 1,4 1,4 @@
- # 7. Multilayer neural networks
+ # 8. Multilayer neural networks
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 is a compact tour of neural networks, from architecture to training, and the gateway to the [Deep Learning](/en/Deep%20Learning) course, which develops every topic here in depth.
@@ 10,7 10,7 @@
- Train by the chain rule and backpropagation, with mini-batches, good initialization, and dropout.
- Guard the implementation with gradient checking and vectorization.
- ## 7.1 Linear versus nonlinear
+ ## 8.1 Linear versus nonlinear
The linear classifiers of the [previous module](/en/Machine%20Learning/06%20Linear%20classification) separate classes with a single straight boundary, so a problem like XOR, which is not linearly separable, is out of reach. Composing units through a nonlinear activation $g$ bends the boundary. The nonlinearity is essential: without it, a stack of linear layers collapses back to a single linear map,
@@ 18,7 18,7 @@
so depth would add nothing. The nonlinear activation is what makes stacking worthwhile.
- ## 7.2 Layers: input, hidden, output
+ ## 8.2 Layers: input, hidden, output
A single neuron computes $a = g(w^T x + b)$. A layer stacks many neurons, and a network stacks layers. Layer $l$ transforms the previous activations into new ones:
@@ 26,19 26,19 @@
The input layer holds $x$, the hidden layers learn intermediate features, and the output layer produces the prediction $\hat{y}$.
- ![Input, hidden, and output layers](/en/Machine%20Learning/07%20Multilayer%20neural%20networks/a/mlp-layers.svg)
+ ![Input, hidden, and output layers](/en/Machine%20Learning/08%20Multilayer%20neural%20networks/a/mlp-layers.svg)
*Each edge carries a weight in $W^{[l]}$ and each unit adds a bias then applies the activation.*
*Remark:* the bias is now written out explicitly and each layer has its own weight matrix $W^{[l]}$, unlike the earlier convention of folding the bias into $\theta^T x$ with $x_0 = 1$. This is the notation the Deep Learning course uses throughout.
- ## 7.3 Output layer: binary and multiclass
+ ## 8.3 Output layer: binary and multiclass
The output layer matches the task, reusing the losses from the previous module. For two classes, a sigmoid output with the binary cross-entropy; for $k$ classes, a softmax output with the categorical cross-entropy:
$$\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)} }$$
- ## 7.4 Activation functions and the zero-centered problem
+ ## 8.4 Activation functions and the zero-centered problem
The hidden activation is usually the sigmoid, the hyperbolic tangent, or the rectified linear unit:
@@ 46,28 46,28 @@
The sigmoid saturates in its tails, 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, and ReLU avoids positive-side saturation altogether, which is why it is the common default.
- ![Activation functions](/en/Machine%20Learning/07%20Multilayer%20neural%20networks/a/activations.png)
+ ![Activation functions](/en/Machine%20Learning/08%20Multilayer%20neural%20networks/a/activations.png)
*The tanh is zero-centered while the sigmoid is not, and ReLU stays linear for positive inputs.*
- ## 7.5 Chain rule and backpropagation
+ ## 8.5 Chain rule and backpropagation
Training minimizes the loss by gradient descent, which needs its gradient with respect to every weight. Backpropagation computes all of them in one forward and one backward sweep: the forward pass caches each $z^{[l]}$ and $a^{[l]}$, then the backward pass applies the chain rule from the loss back to the first layer, reusing the cache. With the layer error $\delta^{[l]} = \partial L / \partial z^{[l]}$,
$$\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 }$$
- ![Forward and backward passes](/en/Machine%20Learning/07%20Multilayer%20neural%20networks/a/backprop.svg)
+ ![Forward and backward passes](/en/Machine%20Learning/08%20Multilayer%20neural%20networks/a/backprop.svg)
*The [Backpropagation](/en/Deep%20Learning/05%20Backpropagation) lesson of the Deep Learning course derives this step by step.*
- ## 7.6 Training in practice
+ ## 8.6 Training in practice
- **Mini-batches.** Estimate the gradient on a small batch of examples at a time, a middle ground between the full batch (accurate but slow) and one example (noisy but cheap).
- **Vanishing gradient.** Through many saturating layers the backpropagated gradient is a product of small factors and shrinks toward zero, so early layers barely learn. ReLU activations and careful initialization keep it alive.
- **Initialization.** Start the weights small and random to break symmetry, scaling the variance by the number of inputs (Xavier or He), so signals neither vanish nor explode through depth.
- - **Dropout.** Randomly zero a fraction of units during training. This prevents units from co-adapting and acts as a regularizer, one of the topics of the [next module](/en/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference).
+ - **Dropout.** Randomly zero a fraction of units during training. This prevents units from co-adapting and acts as a regularizer, in the spirit of the [regularization module](/en/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference).
- ## 7.7 Sanity checks and vectorization
+ ## 8.7 Sanity checks and vectorization
Backpropagation is error-prone, so check the analytic gradient against a numerical finite-difference estimate:
@@ 77,7 77,7 @@
$$\boxed{ Z^{[l]} = W^{[l]} A^{[l-1]} + b^{[l]} }$$
- *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 the linear setting to control model complexity.*
+ *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.*
---
- Next: [Regularization and high-dimensional inference](/en/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference) · [Course overview](/en/Machine%20Learning)
+ Next: [Support Vector Machines](/en/Machine%20Learning/09%20Support%20Vector%20Machines) · [Course overview](/en/Machine%20Learning)
en/Machine Learning/07 Multilayer neural networks/activations.png .. en/Machine Learning/08 Multilayer neural networks/activations.png
en/Machine Learning/07 Multilayer neural networks/backprop.svg .. en/Machine Learning/08 Multilayer neural networks/backprop.svg
en/Machine Learning/07 Multilayer neural networks/mlp-layers.svg .. en/Machine Learning/08 Multilayer neural networks/mlp-layers.svg
fr/Machine Learning.md ..
@@ 12,8 12,8 @@
4. [Formulation probabiliste](/fr/Machine%20Learning/04%20Probabilistic%20formulation)
5. [Régression linéaire](/fr/Machine%20Learning/05%20Linear%20regression)
6. [Classification linéaire](/fr/Machine%20Learning/06%20Linear%20classification)
- 7. [Réseaux de neurones multi-couches](/fr/Machine%20Learning/07%20Multilayer%20neural%20networks)
- 8. [Régularisation et inférence en grande dimension](/fr/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference)
+ 7. [Régularisation et inférence en grande dimension](/fr/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference)
+ 8. [Réseaux de neurones multi-couches](/fr/Machine%20Learning/08%20Multilayer%20neural%20networks)
9. [Machines à vecteurs de support](/fr/Machine%20Learning/09%20Support%20Vector%20Machines)
10. [Arbres de décision et méthodes d'ensemble](/fr/Machine%20Learning/10%20Decision%20trees%20and%20ensemble%20methods)
fr/Machine Learning/05 Linear regression.md ..
@@ 54,7 54,7 @@
C'est la régression régularisée (ridge) : l'a priori gaussien devient une pénalité L2, exactement le lien a priori vers pénalité noté au module précédent.
- *Remarque :* un a priori plus fort (petit $\tau$) signifie un $\lambda$ plus grand et un rétrécissement plus marqué vers zéro. Avec beaucoup de données, la vraisemblance domine l'a priori et l'ajustement du maximum a posteriori se rapproche de celui du maximum de vraisemblance. Choisir le degré $d$ et la pénalité $\lambda$ est un problème de sélection de modèle, réglé par la validation croisée du [module d'évaluation](/fr/Machine%20Learning/03%20Model%20evaluation%20and%20validation), et approfondi dans le [module de régularisation](/fr/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference).
+ *Remarque :* un a priori plus fort (petit $\tau$) signifie un $\lambda$ plus grand et un rétrécissement plus marqué vers zéro. Avec beaucoup de données, la vraisemblance domine l'a priori et l'ajustement du maximum a posteriori se rapproche de celui du maximum de vraisemblance. Choisir le degré $d$ et la pénalité $\lambda$ est un problème de sélection de modèle, réglé par la validation croisée du [module d'évaluation](/fr/Machine%20Learning/03%20Model%20evaluation%20and%20validation), et approfondi dans le [module de régularisation](/fr/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference).
*Le même score linéaire, passé dans une fonction de compression au lieu d'être lu directement, transforme la régression en classification, le sujet du module suivant.*
fr/Machine Learning/06 Linear classification.md ..
@@ 80,4 80,4 @@
*Les modèles linéaires étant couverts, le module suivant contrôle leur complexité : la régularisation et l'inférence quand les régresseurs sont nombreux.*
---
- Suivant : [Réseaux de neurones multi-couches](/fr/Machine%20Learning/07%20Multilayer%20neural%20networks) · [Vue d'ensemble du cours](/fr/Machine%20Learning)
+ Suivant : [Régularisation et inférence en grande dimension](/fr/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference) · [Vue d'ensemble du cours](/fr/Machine%20Learning)
fr/Machine Learning/08 Regularization and high-dimensional inference.md .. fr/Machine Learning/07 Regularization and high-dimensional inference.md
@@ 1,4 1,4 @@
- # 8. Régularisation et inférence en grande dimension
+ # 7. Régularisation et inférence en grande dimension
On n'a souvent pas une poignée de régresseurs propres. Il peut y avoir de nombreux prédicteurs candidats, parfois plus que d'observations, et ils sont corrélés. Les moindres carrés ordinaires surapprennent ou s'effondrent dans ce régime. La régularisation les dompte en rétrécissant les coefficients, et c'est là que la régression régularisée rejoint le plus directement la statistique classique. Elle s'accompagne d'un avertissement : sélectionner des variables puis faire de l'inférence sur les mêmes données invalide les écarts-types classiques, ce qui compte dès que l'objectif est une estimation causale plutôt qu'une prédiction.
@@ 11,11 11,11 @@
- Choisir la pénalité $\lambda$ par validation croisée.
- Reconnaître pourquoi l'inférence naïve après sélection est invalide, et connaître les corrections standard.
- ## 8.1 Pourquoi régulariser
+ ## 7.1 Pourquoi régulariser
Quand le nombre de régresseurs $p$ est grand par rapport à la taille d'échantillon $n$, l'ajustement par moindres carrés poursuit le bruit et ses coefficients ont une variance énorme. Avec des régresseurs corrélés, la matrice $X^T X$ est presque singulière, donc de petites variations des données font osciller fortement les estimations, et quand $p > n$ elle est singulière et les MCO n'ont aucune solution unique. La régularisation accepte un peu de biais en échange d'une forte réduction de variance, le compromis vu dans [Concepts généraux](/fr/Machine%20Learning/02%20General%20concepts).
- ## 8.2 Régression ridge (L2)
+ ## 7.2 Régression ridge (L2)
Ridge ajoute une pénalité en norme au carré sur les coefficients à l'objectif des moindres carrés :
@@ 27,7 27,7 @@
Ridge rétrécit tous les coefficients doucement vers zéro mais ne les annule jamais exactement, elle stabilise donc plutôt qu'elle ne sélectionne.
- ## 8.3 Régression lasso (L1)
+ ## 7.3 Régression lasso (L1)
Le lasso remplace la pénalité au carré par une pénalité en valeur absolue :
@@ 35,17 35,17 @@
Ce petit changement a une grande conséquence : le lasso met certains coefficients exactement à zéro, il effectue donc une sélection de variables tout en ajustant. La raison est géométrique. La région de contrainte $\|\beta\|_1 \le t$ est un losange dont les coins sont sur les axes, et les contours elliptiques de la perte tendent à la toucher d'abord en un coin, où une coordonnée est nulle.
- ![Géométrie des contraintes L1 et L2](/fr/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference/a/l1-l2-geometry.png)
+ ![Géométrie des contraintes L1 et L2](/fr/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference/a/l1-l2-geometry.png)
*La boule L2 arrondie est touchée hors des axes, gardant chaque coefficient non nul, tandis que le losange L1 est touché en un coin, mettant un coefficient exactement à zéro.*
À mesure que la pénalité grandit, davantage de coefficients passent à zéro, traçant le chemin de régularisation du modèle complet jusqu'au modèle vide.
- ![Chemin de régularisation du lasso](/fr/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference/a/regularization-path.png)
+ ![Chemin de régularisation du lasso](/fr/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference/a/regularization-path.png)
*Chaque coefficient rétrécit quand $\lambda$ augmente puis atteint exactement zéro, si bien que le lasso fournit un sous-ensemble compact et interprétable de régresseurs.*
- ## 8.4 Elastic net
+ ## 7.4 Elastic net
L'elastic net mêle les deux pénalités, gardant la sélection du lasso tout en empruntant la stabilité de ridge face aux régresseurs corrélés :
@@ 53,11 53,11 @@
avec $\alpha \in [0, 1]$ dosant la sélection ($\alpha = 1$, lasso) et le rétrécissement ($\alpha = 0$, ridge).
- ## 8.5 Choisir la pénalité
+ ## 7.5 Choisir la pénalité
La pénalité $\lambda$ est un hyperparamètre, on la choisit donc par validation croisée, vue au [module précédent](/fr/Machine%20Learning/03%20Model%20evaluation%20and%20validation) : on ajuste sur une grille de valeurs de $\lambda$ et on garde celle dont l'erreur validée est la plus faible, ou le plus grand $\lambda$ à un écart-type du meilleur pour un modèle plus simple. Un $\lambda$ plus grand signifie plus de rétrécissement, plus de biais et moins de variance.
- ## 8.6 La mise en garde sur l'inférence
+ ## 7.6 La mise en garde sur l'inférence
Prédire n'est pas inférer, et c'est le point qu'il est facile de manquer. Supposons que vous sélectionniez des régresseurs par lasso, puis que vous fassiez des moindres carrés ordinaires sur le sous-ensemble retenu en rapportant les écarts-types des manuels. Ces écarts-types sont faux. Ils ignorent que les données ont déjà servi à choisir les variables, donc les intervalles de confiance sont trop étroits et les p-valeurs ne sont pas valides, une forme de la malédiction du vainqueur. Trois corrections sont standard :
@@ 69,7 69,7 @@
*Remarque :* ces idées ouvrent la porte du machine learning causal, où des apprenants flexibles estiment des fonctions de nuisance tandis qu'une correction préserve une inférence valide sur le paramètre d'intérêt. La régularisation est excellente pour prédire, mais pour un paramètre causal il faut l'une de ces corrections, pas les coefficients pénalisés bruts.
- *Une fois le rétrécissement et la sélection couverts, le module suivant emprunte une autre voie vers une bonne frontière de décision, le classifieur à marge maximale, avant d'aborder les arbres et les ensembles.*
+ *Une fois le rétrécissement et la sélection couverts, le module suivant empile ces briques linéaires en réseaux de neurones multi-couches.*
---
- Suivant : [Machines à vecteurs de support](/fr/Machine%20Learning/09%20Support%20Vector%20Machines) · [Vue d'ensemble du cours](/fr/Machine%20Learning)
+ Suivant : [Réseaux de neurones multi-couches](/fr/Machine%20Learning/08%20Multilayer%20neural%20networks) · [Vue d'ensemble du cours](/fr/Machine%20Learning)
fr/Machine Learning/08 Regularization and high-dimensional inference/l1-l2-geometry.png .. fr/Machine Learning/07 Regularization and high-dimensional inference/l1-l2-geometry.png
fr/Machine Learning/08 Regularization and high-dimensional inference/regularization-path.png .. fr/Machine Learning/07 Regularization and high-dimensional inference/regularization-path.png
fr/Machine Learning/07 Multilayer neural networks.md .. fr/Machine Learning/08 Multilayer neural networks.md
@@ 1,4 1,4 @@
- # 7. Réseaux de neurones multi-couches
+ # 8. Réseaux de neurones multi-couches
Une seule unité linéaire ne trace qu'une frontière droite. Empiler de nombreuses unités simples avec une non-linéarité entre elles donne un réseau de neurones multi-couches, qui ajuste des frontières courbes et apprend ses propres caractéristiques. Ce module est un tour d'horizon compact des réseaux de neurones, de l'architecture à l'entraînement, et la porte d'entrée du cours de [Deep Learning](/fr/Deep%20Learning), qui développe en profondeur chaque sujet abordé ici.
@@ 10,7 10,7 @@
- Entraîner par la règle de dérivation en chaîne et la rétropropagation, avec des mini-lots, une bonne initialisation et le dropout.
- Protéger l'implémentation par la vérification du gradient et la vectorisation.
- ## 7.1 Linéaire contre non linéaire
+ ## 8.1 Linéaire contre non linéaire
Les classifieurs linéaires du [module précédent](/fr/Machine%20Learning/06%20Linear%20classification) séparent les classes par une seule frontière droite, si bien qu'un problème comme XOR, non linéairement séparable, est hors de portée. Composer des unités à travers une activation non linéaire $g$ courbe la frontière. La non-linéarité est essentielle : sans elle, une pile de couches linéaires se réduit à une seule application linéaire,
@@ 18,7 18,7 @@
et la profondeur n'apporterait rien. C'est l'activation non linéaire qui rend l'empilement utile.
- ## 7.2 Les couches : entrée, cachée, sortie
+ ## 8.2 Les couches : entrée, cachée, sortie
Un neurone calcule $a = g(w^T x + b)$. Une couche empile plusieurs neurones, et un réseau empile des couches. La couche $l$ transforme les activations précédentes en nouvelles :
@@ 26,19 26,19 @@
La couche d'entrée contient $x$, les couches cachées apprennent des caractéristiques intermédiaires, et la couche de sortie produit la prédiction $\hat{y}$.
- ![Couches d'entrée, cachées et de sortie](/fr/Machine%20Learning/07%20Multilayer%20neural%20networks/a/mlp-layers.svg)
+ ![Couches d'entrée, cachées et de sortie](/fr/Machine%20Learning/08%20Multilayer%20neural%20networks/a/mlp-layers.svg)
*Chaque arête porte un poids de $W^{[l]}$ et chaque unité ajoute un biais puis applique l'activation.*
*Remarque :* le biais est désormais écrit explicitement et chaque couche a sa propre matrice de poids $W^{[l]}$, contrairement à la convention antérieure qui repliait le biais dans $\theta^T x$ avec $x_0 = 1$. C'est la notation utilisée tout au long du cours de Deep Learning.
- ## 7.3 Couche de sortie : binaire et multiclasse
+ ## 8.3 Couche de sortie : binaire et multiclasse
La couche de sortie s'adapte à la tâche, en réutilisant les pertes du module précédent. Pour deux classes, une sortie sigmoïde avec l'entropie croisée binaire ; pour $k$ classes, une sortie softmax avec l'entropie croisée catégorielle :
$$\boxed{ \hat{y} = \frac{1}{1 + e^{-z}} \quad\text{(binaire)} \qquad \hat{y}_c = \frac{e^{z_c}}{\sum_{j} e^{z_j}} \quad\text{(multiclasse)} }$$
- ## 7.4 Fonctions d'activation et le problème du non-centrage en zéro
+ ## 8.4 Fonctions d'activation et le problème du non-centrage en zéro
L'activation cachée est généralement la sigmoïde, la tangente hyperbolique ou l'unité de rectification linéaire :
@@ 46,28 46,28 @@
La sigmoïde sature dans ses queues, et ses sorties ne sont jamais négatives, donc les poids entrants d'une unité reçoivent des gradients de même signe et les mises à jour zigzaguent. La $\tanh$, centrée en zéro, supprime ce biais, et ReLU évite complètement la saturation du côté positif, ce qui en fait le choix par défaut courant.
- ![Fonctions d'activation](/fr/Machine%20Learning/07%20Multilayer%20neural%20networks/a/activations.png)
+ ![Fonctions d'activation](/fr/Machine%20Learning/08%20Multilayer%20neural%20networks/a/activations.png)
*La tanh est centrée en zéro alors que la sigmoïde ne l'est pas, et ReLU reste linéaire pour les entrées positives.*
- ## 7.5 Règle de dérivation en chaîne et rétropropagation
+ ## 8.5 Règle de dérivation en chaîne et rétropropagation
L'entraînement minimise la perte par descente de gradient, qui a besoin de son gradient par rapport à chaque poids. La rétropropagation les calcule tous en une passe avant et une passe arrière : la passe avant met en cache chaque $z^{[l]}$ et $a^{[l]}$, puis la passe arrière applique la règle de dérivation en chaîne de la perte jusqu'à la première couche, en réutilisant le cache. Avec l'erreur de couche $\delta^{[l]} = \partial L / \partial z^{[l]}$,
$$\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 }$$
- ![Passes avant et arrière](/fr/Machine%20Learning/07%20Multilayer%20neural%20networks/a/backprop.svg)
+ ![Passes avant et arrière](/fr/Machine%20Learning/08%20Multilayer%20neural%20networks/a/backprop.svg)
*La leçon [Rétropropagation](/fr/Deep%20Learning/05%20Backpropagation) du cours de Deep Learning la dérive pas à pas.*
- ## 7.6 L'entraînement en pratique
+ ## 8.6 L'entraînement en pratique
- **Mini-lots.** Estimer le gradient sur un petit lot d'exemples à la fois, un compromis entre le lot complet (précis mais lent) et un seul exemple (bruité mais peu coûteux).
- **Disparition du gradient.** À travers de nombreuses couches qui saturent, le gradient rétropropagé est un produit de petits facteurs et tend vers zéro, si bien que les premières couches n'apprennent presque pas. Les activations ReLU et une initialisation soignée le maintiennent vivant.
- **Initialisation.** Démarrer les poids petits et aléatoires pour briser la symétrie, en mettant la variance à l'échelle du nombre d'entrées (Xavier ou He), pour que les signaux ne s'évanouissent ni n'explosent avec la profondeur.
- - **Dropout.** Mettre à zéro au hasard une fraction des unités pendant l'entraînement. Cela empêche les unités de se co-adapter et agit comme un régulariseur, l'un des sujets du [module suivant](/fr/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference).
+ - **Dropout.** Mettre à zéro au hasard une fraction des unités pendant l'entraînement. Cela empêche les unités de se co-adapter et agit comme un régulariseur, dans l'esprit du [module de régularisation](/fr/Machine%20Learning/07%20Regularization%20and%20high-dimensional%20inference).
- ## 7.7 Tests de validité et vectorisation
+ ## 8.7 Tests de validité et vectorisation
La rétropropagation est source d'erreurs, alors on compare le gradient analytique à une estimation numérique par différences finies :
@@ 77,7 77,7 @@
$$\boxed{ Z^{[l]} = W^{[l]} A^{[l-1]} + b^{[l]} }$$
- *Ce module est la porte d'entrée du cours de [Deep Learning](/fr/Deep%20Learning), qui développe pleinement les architectures, les optimiseurs, l'initialisation, la normalisation et la régularisation. Le module suivant revient au cadre linéaire pour contrôler la complexité du modèle.*
+ *Ce module est la porte d'entrée du cours de [Deep Learning](/fr/Deep%20Learning), qui développe pleinement les architectures, les optimiseurs, l'initialisation, la normalisation et la régularisation. Le module suivant revient aux modèles linéaires sous un nouvel angle, le classifieur à marge maximale.*
---
- Suivant : [Régularisation et inférence en grande dimension](/fr/Machine%20Learning/08%20Regularization%20and%20high-dimensional%20inference) · [Vue d'ensemble du cours](/fr/Machine%20Learning)
+ Suivant : [Machines à vecteurs de support](/fr/Machine%20Learning/09%20Support%20Vector%20Machines) · [Vue d'ensemble du cours](/fr/Machine%20Learning)
fr/Machine Learning/07 Multilayer neural networks/activations.png .. fr/Machine Learning/08 Multilayer neural networks/activations.png
fr/Machine Learning/07 Multilayer neural networks/backprop.svg .. fr/Machine Learning/08 Multilayer neural networks/backprop.svg
fr/Machine Learning/07 Multilayer neural networks/mlp-layers.svg .. fr/Machine Learning/08 Multilayer neural networks/mlp-layers.svg
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9