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
# 1. Introduction
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
Machine learning builds models that learn patterns from data instead of being explicitly programmed with rules. This module fixes the notation used throughout the course and maps the landscape of problems and models, so later modules can stay terse and formula-first.
4
5
**Objectives**
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.
6
- Distinguish supervised, unsupervised, and reinforcement learning by their feedback signal.
7
- Situate the stages of a machine learning project and its feedback loops.
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>
8
- Fix the notation used across the whole course.
9
- Define the training set, the hypothesis, and the design matrix.
10
- Adopt the intercept convention $x_0 = 1$.
11
- Classify a supervised problem by the type of its output.
12
- Distinguish discriminative from generative models.
13
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.
14
## 1.1 Types of learning
15
16
Machine learning problems are usually sorted into three paradigms. What separates them is not the algorithm but the feedback available during training: a label for every example, no labels at all, or a reward that arrives through interaction.
17
18
![The three types of learning](/en/Machine%20Learning/01%20Introduction/a/types-of-learning.svg)
19
20
*Supervised learning fits a mapping from labelled examples, unsupervised learning finds structure in unlabelled data, and reinforcement learning improves a policy through interaction with an environment.*
21
22
**Supervised learning.** Each training example pairs an input $x$ with the answer $y$ the model should produce, and the goal is a mapping $x \mapsto y$ that generalizes to inputs never seen in training. Predicting the price of a house from its features (regression) and deciding whether an email is spam (classification) are the canonical tasks. Labels make the objective explicit and progress measurable, which is why the theory is most developed here. Almost all of this course lives in this setting.
23
24
**Unsupervised learning.** Only the inputs $x$ are available, and no label says what the right answer is. The goal shifts from prediction to description: group similar customers into segments (clustering), compress many correlated features into a few informative directions (dimensionality reduction), or estimate which regions of the input space are likely (density estimation). Success is harder to quantify, because there is no ground truth to compare against.
25
26
**Reinforcement learning.** There is no fixed dataset at all. An agent takes an action, the environment returns a new state and a reward, and the reward may arrive long after the action that earned it. The goal is a policy, a rule for choosing actions that maximizes the cumulative reward. Game playing and robotics are the typical examples. It is a field of its own and sits outside the scope of this course.
27
28
| Paradigm | Data | Feedback signal | What is learned | Canonical tasks |
29
| --- | --- | --- | --- | --- |
30
| Supervised | pairs $(x, y)$ | the label $y$ | a mapping $h : x \mapsto y$ | regression, classification |
31
| Unsupervised | inputs $x$ only | none | structure in the data | clustering, dimensionality reduction |
32
| Reinforcement | interaction | reward, often delayed | a policy for acting | control, game playing |
33
34
*Remark:* the boundaries are not rigid. Semi-supervised learning mixes a few labelled examples with many unlabelled ones, and self-supervised learning manufactures labels from the data itself, for example by hiding a word and predicting it. Both reuse the supervised machinery introduced in this course.
35
36
## 1.2 The workflow
37
38
A machine learning project is not a straight line from data to model. It runs as a loop: every evaluation reveals something that sends the work back to an earlier stage, and once deployed, a model faces new data that eventually restarts the cycle.
39
40
![The machine learning workflow](/en/Machine%20Learning/01%20Introduction/a/ml-workflow.svg)
41
42
*The solid path is the nominal order. The dashed arrows are where real projects spend most of their time: reworking features and models after evaluation, and retraining after monitoring.*
43
44
1. **Define the problem and gather data.** Turn the question into a prediction task by fixing the input $x$, the target $y$, and the metric that counts as success. The choices made here bound everything downstream, because no model can recover information the data does not contain.
45
2. **Explore and preprocess the data.** Inspect distributions, missing values, and outliers, then clean, encode, and scale the features. Set aside a test set before tuning anything against it, so the final performance estimate stays honest.
46
3. **Train candidate models.** Start with a simple baseline, then fit richer families by minimizing a loss over the parameters $\theta$ ([General concepts](/en/Machine%20Learning/02%20General%20concepts)).
47
4. **Evaluate and compare.** Measure each candidate on data it has never seen, with validation and cross-validation ([General concepts](/en/Machine%20Learning/02%20General%20concepts)) and a metric matched to the problem. The verdict usually points back to step 2 or 3: better features, another model family, or more data.
48
5. **Deploy and monitor.** In production the incoming data drifts away from the training distribution, so performance must be watched and retraining planned. That discipline has its own course: [MLOps](/en/MLOps).
49
50
*Remark:* in practice most of the effort goes into steps 1, 2, and 4. Training itself is often the cheapest step, and the ceiling on model quality is set by the data.
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
## 1.3 Notation and setup
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
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.
54
### 1.3.1 Training set
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>
55
56
The training set is defined as a collection of $m$ labelled examples:
57
58
$$\boxed{ \{(x^{(i)}, y^{(i)})\}_{i=1}^{m} }$$
59
60
Symbols:
61
- $x^{(i)}$ is the input (feature vector) of the $i$-th example.
62
- $y^{(i)}$ is its target (label).
63
- $m$ is the number of training examples.
64
- $n$ is the number of features.
65
- $x_j^{(i)}$ is the $j$-th feature of the $i$-th example.
66
67
*Remark:* the superscript $(i)$ indexes the example and the subscript $j$ indexes the feature, so $x_j^{(i)}$ is feature $j$ of example $i$.
68
69
By convention the input is augmented with a constant intercept term $x_0 = 1$, so $x \in \mathbb{R}^{n+1}$ and the parameters are $\theta \in \mathbb{R}^{n+1}$.
70
71
$$\boxed{ x_0 = 1, \quad x \in \mathbb{R}^{n+1}, \quad \theta \in \mathbb{R}^{n+1} }$$
72
73
*Remark:* the intercept lets a single dot product $\theta^T x$ carry the bias term, so no separate constant has to be written.
74
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.
75
### 1.3.2 Hypothesis
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>
76
77
A hypothesis is defined as a function chosen from a model family that maps an input to a prediction:
78
79
$$\boxed{ h_\theta : x \mapsto h_\theta(x) }$$
80
81
Learning is the search, over the parameters $\theta$, for the hypothesis that best fits the training set.
82
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.
83
### 1.3.3 Design matrix
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>
84
85
The design matrix stacks the $m$ transposed inputs row by row, and the target vector collects the labels:
86
87
$$\boxed{ X = \begin{bmatrix} (x^{(1)})^{T} \\ \vdots \\ (x^{(m)})^{T} \end{bmatrix}, \quad y = \begin{bmatrix} y^{(1)} \\ \vdots \\ y^{(m)} \end{bmatrix} }$$
88
89
Here $X \in \mathbb{R}^{m \times (n+1)}$ (each augmented input is a row) and $y \in \mathbb{R}^{m}$.
90
91
*Remark:* with this layout many models reduce to compact matrix expressions, for example a linear prediction over all examples is $X\theta$.
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
## 1.4 Types of problems and models
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
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.
95
### 1.4.1 Type of prediction
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>
96
97
A supervised problem is named by the nature of its target $y$.
98
99
| Type | Target | Goal |
100
| --- | --- | --- |
101
| Regression | $y \in \mathbb{R}$ | predict a continuous value |
102
| Classification | $y \in \{1, \dots, k\}$ | predict one of $k$ discrete classes |
103
104
*Remark:* binary classification is the case $k = 2$, often coded as $y \in \{0, 1\}$ or $y \in \{-1, +1\}$.
105
106
![Regression versus classification](/en/Machine%20Learning/01%20Introduction/a/regression-vs-classification.png)
107
108
*Left: regression fits a continuous output. Right: classification separates the input space into classes.*
109
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.
110
### 1.4.2 Type of model
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>
111
112
A model is discriminative if it learns the conditional $p(y \mid x)$ directly, and generative if it models how the data are generated, $p(x \mid y)$ and $p(y)$, then inverts via Bayes' rule:
113
114
$$\boxed{ p(y \mid x) = \frac{p(x \mid y)\, p(y)}{p(x)} }$$
115
116
| Aspect | Discriminative | Generative |
117
| --- | --- | --- |
118
| Goal | model the boundary between classes | model how each class generates data |
119
| What is learned | $p(y \mid x)$ directly | $p(x \mid y)$ and $p(y)$, then Bayes |
120
| Examples | logistic regression, SVM | Gaussian discriminant analysis, naive Bayes |
121
122
*Remark:* $p(x)$ is the same for every class, so for classification it can be dropped and the most probable class taken via $\arg\max_y\, p(x \mid y)\, p(y)$.
123
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.
124
### 1.4.3 Putting it together
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>
125
126
The output type fixes regression vs classification, and the modelling choice fixes discriminative vs generative. Together they select a model family.
127
128
```mermaid
129
graph TD
130
A["supervised problem"] --> B{"output type?"}
131
B -->|"continuous"| C["regression"]
132
B -->|"discrete"| D["classification"]
133
D --> E{"model type?"}
134
E -->|"discriminative"| F["logistic regression, SVM"]
135
E -->|"generative"| G["GDA, naive Bayes"]
136
```
137
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.
138
*With the problem framed and the notation fixed, the next part turns to what learning really demands: minimizing a loss is easy, generalizing beyond the training set is the challenge.*
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>
139
140
---
141
Next: [General concepts](/en/Machine%20Learning/02%20General%20concepts) · [Course overview](/en/Machine%20Learning)