Blame

d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
1
# 2. Concepts généraux
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2
3
Les briques communes à tout modèle supervisé : comment une perte mesure une prédiction isolée puis s'agrège en un coût, comment l'optimisation itérative minimise ce coût, et comment le point de vue probabiliste (la vraisemblance) retrouve les mêmes objectifs. On termine par l'algorithme de Newton, une alternative du second ordre à la descente de gradient.
4
5
**Objectifs**
6
- Définir une fonction de perte et agréger les pertes par exemple en un unique coût à minimiser.
7
- Énoncer la règle de mise à jour de la descente de gradient et opposer ses variantes par lots et stochastique.
8
- Définir la vraisemblance et l'objectif du maximum de vraisemblance, et le relier à la minimisation d'un coût.
9
- Énoncer la mise à jour de Newton en une et plusieurs dimensions et la comparer à la descente de gradient.
10
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
11
## 2.1 Fonctions de perte et coût
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
12
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
13
### 2.1.1 Fonction de perte
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
14
15
Une fonction de perte $L(z, y)$ est définie comme une pénalité scalaire comparant un score brut $z$ du modèle (ou une probabilité prédite $\phi$) à la cible $y$. Plus elle est petite, mieux c'est. Chaque famille de modèles se caractérise par sa perte.
16
17
| Perte | Formule $L(z,y)$ | Utilisée par |
18
| --- | --- | --- |
19
| Erreur quadratique | $\tfrac{1}{2}(y-z)^2$ | Régression linéaire |
20
| Logistique | $\log\!\left(1+\exp(-yz)\right)$ | Régression logistique |
21
| Charnière | $\max(0,\,1-yz)$ | SVM |
22
| Entropie croisée | $-\left[\,y\log\phi+(1-y)\log(1-\phi)\,\right]$ | Réseaux de neurones |
23
24
*Remarque :* $z$ désigne un score brut tel que $\theta^T x$, tandis que $\phi \in (0,1)$ désigne une probabilité prédite. La ligne d'entropie croisée prend une probabilité $\phi$, non un score brut.
25
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
26
### 2.1.2 Fonction de coût
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27
28
Le coût $J(\theta)$ est défini comme la somme des pertes par exemple sur tout l'ensemble d'entraînement de $m$ exemples :
29
30
$$\boxed{\,J(\theta)=\sum_{i=1}^{m} L\!\left(h_\theta(x^{(i)}),\,y^{(i)}\right)\,}$$
31
32
Entraîner un modèle, c'est choisir $\theta$ qui minimise $J(\theta)$. La leçon suivante montre comment.
33
34
*Remarque :* le facteur $\tfrac{1}{2}$ de l'erreur quadratique est une convention qui s'annule avec l'exposant lors de la dérivation, laissant un gradient propre.
35
36
![Fonctions de perte basées sur la marge](/fr/Machine%20Learning/02%20General%20concepts/a/loss-functions.png)
37
38
*Pertes basées sur la marge, chacune un substitut convexe de la perte 0-1 qui pénalise les marges faibles ou négatives.*
39
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
40
## 2.2 Descente de gradient
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
42
### 2.2.1 Règle de mise à jour
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
43
44
La descente de gradient déplace itérativement les paramètres $\theta$ à l'opposé du gradient du coût, mis à l'échelle par un taux d'apprentissage $\alpha > 0$ :
45
46
$$\boxed{\,\theta \leftarrow \theta - \alpha\,\nabla_\theta J(\theta)\,}$$
47
48
Le gradient pointe dans la direction de plus forte croissance, donc avancer à son opposé fait décroître $J$. Le pas $\alpha$ contrôle l'ampleur de chaque mise à jour.
49
50
*Remarque :* si $\alpha$ est trop grand les itérés peuvent diverger, s'il est trop petit la convergence est lente.
51
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
52
### 2.2.2 Par lots ou stochastique
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
53
54
Les deux variantes diffèrent par le nombre d'exemples contribuant à une mise à jour.
55
56
| Variante | Exemples par mise à jour | Mise à jour |
57
| --- | --- | --- |
58
| Par lots | Tous les $m$ | $\theta \leftarrow \theta - \alpha\,\nabla_\theta J(\theta)$ |
59
| Stochastique (SGD) | Un seul $(x^{(i)}, y^{(i)})$ | $\theta \leftarrow \theta - \alpha\,\nabla_\theta L\!\left(h_\theta(x^{(i)}), y^{(i)}\right)$ |
60
61
Le mode par lots donne une descente lisse mais lit tout l'ensemble à chaque pas. SGD met à jour après chaque exemple, donc peu coûteux par pas et bruité.
62
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
63
### 2.2.3 Mise à jour LMS (Widrow-Hoff)
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
64
65
Pour l'erreur quadratique, la mise à jour stochastique par coordonnée est définie comme :
66
67
$$\boxed{\,\theta_j \leftarrow \theta_j + \alpha\left(y^{(i)} - h_\theta(x^{(i)})\right)x_j^{(i)}\,}$$
68
69
La correction est proportionnelle au résidu $y^{(i)} - h_\theta(x^{(i)})$ multiplié par la composante $x_j^{(i)}$.
70
71
*Remarque :* un grand résidu produit un grand pas, une prédiction correcte ne produit aucune mise à jour.
72
73
![Trajectoire de la descente de gradient](/fr/Machine%20Learning/02%20General%20concepts/a/gradient-descent.png)
74
75
*La descente de gradient descend la pente vers le minimum (étoile).*
76
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
77
## 2.3 Vraisemblance et estimation du maximum de vraisemblance
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
78
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
79
### 2.3.1 Vraisemblance
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
80
81
La vraisemblance $L(\theta)$ est définie comme la probabilité des cibles observées sous le modèle, vue comme une fonction des paramètres $\theta$. En supposant les exemples indépendants, elle se factorise :
82
83
$$\boxed{\,L(\theta)=\prod_{i=1}^{m} p\!\left(y^{(i)} \mid x^{(i)}; \theta\right)\,}$$
84
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
85
### 2.3.2 Log-vraisemblance
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
86
87
Les produits sont malcommodes à optimiser, on prend donc le logarithme. La log-vraisemblance $\ell(\theta)$ est définie comme :
88
89
$$\boxed{\,\ell(\theta)=\sum_{i=1}^{m} \log p\!\left(y^{(i)} \mid x^{(i)}; \theta\right)\,}$$
90
91
Le $\log$ est monotone, il a donc le même maximiseur que $L(\theta)$ tout en transformant le produit en somme.
92
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
93
### 2.3.3 Estimation du maximum de vraisemblance
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
94
95
Le maximum de vraisemblance est défini comme la valeur des paramètres qui rend les données les plus probables :
96
97
$$\boxed{\,\theta_{\mathrm{MLE}}=\arg\max_\theta\,\ell(\theta)\,}$$
98
99
*Remarque :* maximiser la log-vraisemblance équivaut à minimiser le coût $J(\theta) = -\ell(\theta)$. C'est exactement la vue par minimisation du coût des leçons précédentes, vraisemblance et coût sont donc deux faces d'un même objectif.
100
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
101
## 2.4 Algorithme de Newton
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
102
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
103
### 2.4.1 Mise à jour unidimensionnelle
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
104
105
Pour trouver un point stationnaire de la log-vraisemblance, l'algorithme de Newton suit l'approximation quadratique locale. La mise à jour scalaire est définie comme :
106
107
$$\boxed{\,\theta \leftarrow \theta - \frac{\ell'(\theta)}{\ell''(\theta)}\,}$$
108
109
Elle divise la dérivée première par la dérivée seconde, donc le pas s'adapte automatiquement à la courbure.
110
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
111
### 2.4.2 Mise à jour multivariée
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
112
113
Avec un vecteur de paramètres $\theta \in \mathbb{R}^{n+1}$, la dérivée seconde devient la matrice hessienne $H$, avec $H_{jk}=\dfrac{\partial^2 \ell}{\partial\theta_j\,\partial\theta_k}$. La mise à jour est définie comme :
114
115
$$\boxed{\,\theta \leftarrow \theta - H^{-1}\,\nabla_\theta \ell(\theta)\,}$$
116
117
*Remarque :* chaque pas résout un système linéaire en $H$, une opération en $O(n^3)$, donc l'algorithme de Newton est coûteux quand le nombre de variables $n$ est grand.
118
d5b8b5 lugonthier 2026-07-01 14:24:01
Refactor section headings for consistency and clarity across multiple documents in the Machine Learning module. Updated headings to include numerical prefixes for better organization and navigation. Adjusted content formatting and improved terminology in French translations for decision trees, ensemble methods, and other foundational concepts.
119
### 2.4.3 Newton ou descente de gradient
1c3139 Lucas Gonthier 2026-06-30 12:04:21
Initial commit: course content (Machine Learning, MLOps) in EN and FR Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
120
121
| Propriété | Algorithme de Newton | Descente de gradient |
122
| --- | --- | --- |
123
| Ordre | Second (utilise la courbure $H$) | Premier (utilise le gradient seul) |
124
| Coût par pas | Élevé ($O(n^3)$, inverse $H$) | Faible ($O(n)$ par exemple) |
125
| Convergence | Quadratique près de l'optimum, peu de pas | Linéaire, beaucoup de pas |
126
| Réglage | Aucun taux d'apprentissage | Nécessite un taux $\alpha$ |
127
128
*Remarque :* l'algorithme de Newton converge en très peu d'itérations mais paie un coût élevé par pas, donc la descente de gradient est préférée quand $n$ est grand.
129
130
*Ces outils sont indépendants du modèle. La partie suivante les applique à la classe d'hypothèses la plus simple, où la prédiction est une fonction linéaire des variables : les modèles linéaires.*
131
132
---
133
Suivant : [Modèles linéaires](/fr/Machine%20Learning/03%20Linear%20models) · [Vue d'ensemble du cours](/fr/Machine%20Learning)