Blame

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>
1
# Introduction
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
## Types of learning
6
7
- **Supervised**: learn from labelled examples (regression, classification).
8
- **Unsupervised**: find structure in unlabelled data (clustering, dimensionality reduction).
9
- **Reinforcement**: learn from feedback by interacting with an environment.
10
11
## The workflow
12
13
1. Define the problem and gather data.
14
2. Explore and preprocess the data.
15
3. Train candidate models.
16
4. Evaluate and compare them.
17
5. Deploy and monitor (see the [MLOps](/en/MLOps) course).
18
19
**Objectives**
20
- Fix the notation used across the whole course.
21
- Define the training set, the hypothesis, and the design matrix.
22
- Adopt the intercept convention $x_0 = 1$.
23
- Classify a supervised problem by the type of its output.
24
- Distinguish discriminative from generative models.
25
26
## Notation and setup
27
28
### Training set
29
30
The training set is defined as a collection of $m$ labelled examples:
31
32
$$\boxed{ \{(x^{(i)}, y^{(i)})\}_{i=1}^{m} }$$
33
34
Symbols:
35
- $x^{(i)}$ is the input (feature vector) of the $i$-th example.
36
- $y^{(i)}$ is its target (label).
37
- $m$ is the number of training examples.
38
- $n$ is the number of features.
39
- $x_j^{(i)}$ is the $j$-th feature of the $i$-th example.
40
41
*Remark:* the superscript $(i)$ indexes the example and the subscript $j$ indexes the feature, so $x_j^{(i)}$ is feature $j$ of example $i$.
42
43
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}$.
44
45
$$\boxed{ x_0 = 1, \quad x \in \mathbb{R}^{n+1}, \quad \theta \in \mathbb{R}^{n+1} }$$
46
47
*Remark:* the intercept lets a single dot product $\theta^T x$ carry the bias term, so no separate constant has to be written.
48
49
### Hypothesis
50
51
A hypothesis is defined as a function chosen from a model family that maps an input to a prediction:
52
53
$$\boxed{ h_\theta : x \mapsto h_\theta(x) }$$
54
55
Learning is the search, over the parameters $\theta$, for the hypothesis that best fits the training set.
56
57
### Design matrix
58
59
The design matrix stacks the $m$ transposed inputs row by row, and the target vector collects the labels:
60
61
$$\boxed{ X = \begin{bmatrix} (x^{(1)})^{T} \\ \vdots \\ (x^{(m)})^{T} \end{bmatrix}, \quad y = \begin{bmatrix} y^{(1)} \\ \vdots \\ y^{(m)} \end{bmatrix} }$$
62
63
Here $X \in \mathbb{R}^{m \times (n+1)}$ (each augmented input is a row) and $y \in \mathbb{R}^{m}$.
64
65
*Remark:* with this layout many models reduce to compact matrix expressions, for example a linear prediction over all examples is $X\theta$.
66
67
## Types of problems and models
68
69
### Type of prediction
70
71
A supervised problem is named by the nature of its target $y$.
72
73
| Type | Target | Goal |
74
| --- | --- | --- |
75
| Regression | $y \in \mathbb{R}$ | predict a continuous value |
76
| Classification | $y \in \{1, \dots, k\}$ | predict one of $k$ discrete classes |
77
78
*Remark:* binary classification is the case $k = 2$, often coded as $y \in \{0, 1\}$ or $y \in \{-1, +1\}$.
79
80
![Regression versus classification](/en/Machine%20Learning/01%20Introduction/a/regression-vs-classification.png)
81
82
*Left: regression fits a continuous output. Right: classification separates the input space into classes.*
83
84
### Type of model
85
86
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:
87
88
$$\boxed{ p(y \mid x) = \frac{p(x \mid y)\, p(y)}{p(x)} }$$
89
90
| Aspect | Discriminative | Generative |
91
| --- | --- | --- |
92
| Goal | model the boundary between classes | model how each class generates data |
93
| What is learned | $p(y \mid x)$ directly | $p(x \mid y)$ and $p(y)$, then Bayes |
94
| Examples | logistic regression, SVM | Gaussian discriminant analysis, naive Bayes |
95
96
*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)$.
97
98
### Putting it together
99
100
The output type fixes regression vs classification, and the modelling choice fixes discriminative vs generative. Together they select a model family.
101
102
```mermaid
103
graph TD
104
A["supervised problem"] --> B{"output type?"}
105
B -->|"continuous"| C["regression"]
106
B -->|"discrete"| D["classification"]
107
D --> E{"model type?"}
108
E -->|"discriminative"| F["logistic regression, SVM"]
109
E -->|"generative"| G["GDA, naive Bayes"]
110
```
111
112
*With the problem framed and the notation fixed, the next part introduces the tools used to fit a model to data: loss functions, gradient descent, and maximum likelihood.*
113
114
---
115
Next: [General concepts](/en/Machine%20Learning/02%20General%20concepts) · [Course overview](/en/Machine%20Learning)