A computer code with red lines

AI-generated content may be incorrect.
SCIENCES PO
INTRODUCTORY AI COURSE · SESSION 2
Intelligent Machines
How Do Machines Learn?
PRESENTED BY
Evan Dufraisse
9 August 2026
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
CENTRAL QUESTION
Central Question
What does it mean for a machine to learn?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
CENTRAL QUESTION
Quizz: What do we need to learn?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
How do machines learn? Several Paradigms
Human learning
Machine learning
Someone shows you examples of what are cats and dogs.
Supervised learning: learn from examples paired with the correct answer.
Without being taught their names, you notice that birds seem to form different groups.
Unsupervised learning: discover patterns or groups in unlabeled data.
You learn to ride a bike through trial and error, adjusting your actions to maintain balance.
Reinforcement learning: learn which actions work through their consequences.
Knowing tennis helps you learn padel or badminton faster.
Transfer learning: reuse knowledge learned for one task on a related task.
You hide a word in a sentence and try to reconstruct it from context.
Self-supervised learning: create the learning task from the data itself.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Supervised Learning: Classification and Regression
A screenshot of a diagram

AI-generated content may be incorrect.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
How do machines learn? Several Paradigms
Human learning
Machine learning
Someone shows you examples of what are cats and dogs.
Supervised learning: learn from examples paired with the correct answer.
Without being taught their names, you notice that birds seem to form different groups.
Unsupervised learning: discover patterns or groups in unlabeled data.
You learn to ride a bike through trial and error, adjusting your actions to maintain balance.
Reinforcement learning: learn which actions work through their consequences.
Knowing tennis helps you learn padel or badminton faster.
Transfer learning: reuse knowledge learned for one task on a related task.
You hide a word in a sentence and try to reconstruct it from context.
Self-supervised learning: create the learning task from the data itself.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Unsupervised Learning: Discovering structure without labels
A diagram of a structure

AI-generated content may be incorrect.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
How do machines learn? Several Paradigms
Human learning
Machine learning
Someone shows you examples of what are cats and dogs.
Supervised learning: learn from examples paired with the correct answer.
Without being taught their names, you notice that birds seem to form different groups.
Unsupervised learning: discover patterns or groups in unlabeled data.
You learn to ride a bike through trial and error, adjusting your actions to maintain balance.
Reinforcement learning: learn which actions work through their consequences.
Knowing tennis helps you learn padel or badminton faster.
Transfer learning: reuse knowledge learned for one task on a related task.
You hide a word in a sentence and try to reconstruct it from context.
Self-supervised learning: create the learning task from the data itself.
Different kinds of birds collection 6770869 Vector Art at Vecteezy
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
How do machines learn? Several Paradigms
Human learning
Machine learning
Someone shows you examples of what are cats and dogs.
Supervised learning: learn from examples paired with the correct answer.
Without being taught their names, you notice that birds seem to form different groups.
Unsupervised learning: discover patterns or groups in unlabeled data.
You learn to ride a bike through trial and error, adjusting your actions to maintain balance.
Reinforcement learning: learn which actions work through their consequences.
Knowing tennis helps you learn padel or badminton faster.
Transfer learning: reuse knowledge learned for one task on a related task.
You hide a word in a sentence and try to reconstruct it from context.
Self-supervised learning: create the learning task from the data itself.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
How do machines learn? Several Paradigms
Human learning
Machine learning
Someone shows you examples of what are cats and dogs.
Supervised learning: learn from examples paired with the correct answer.
Without being taught their names, you notice that birds seem to form different groups.
Unsupervised learning: discover patterns or groups in unlabeled data.
You learn to ride a bike through trial and error, adjusting your actions to maintain balance.
Reinforcement learning: learn which actions work through their consequences.
Knowing tennis helps you learn padel or badminton faster.
Transfer learning: reuse knowledge learned for one task on a related task.
You hide a word in a sentence and try to reconstruct it from context.
Self-supervised learning: create the learning task from the data itself.
A group of tennis rackets

AI-generated content may be incorrect.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
How do machines learn? Several Paradigms
Human learning
Machine learning
Someone shows you examples of what are cats and dogs.
Supervised learning: learn from examples paired with the correct answer.
Without being taught their names, you notice that birds seem to form different groups.
Unsupervised learning: discover patterns or groups in unlabeled data.
You learn to ride a bike through trial and error, adjusting your actions to maintain balance.
Reinforcement learning: learn which actions work through their consequences.
Knowing tennis helps you learn padel or badminton faster.
Transfer learning: reuse knowledge learned for one task on a related task.
You hide a word in a sentence and try to reconstruct it from context.
Self-supervised learning: create the learning task from the data itself.
A black text on a white background

AI-generated content may be incorrect.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Classification Problem: Cat or Dog?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Classification Problem: Cat or Dog?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Classification Problem: Cat or Dog?
A Classification Problem:
HOW MACHINES LEARN SESSION 2 A Classification Problem: Cat or Dog?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Classification Problem: Cat or Dog?
?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Classification Problem: Cat or Dog?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Classification Problem: Cat or Dog?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Classification Problem: Cat or Dog?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A diagram of a cat model

AI-generated content may be incorrect.
The Training Process
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A diagram of a cat model

AI-generated content may be incorrect.
The Training Process
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A diagram of a cat model

AI-generated content may be incorrect.
The Training Process
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A diagram of a cat model

AI-generated content may be incorrect.
The Training Process
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A diagram of a cat model

AI-generated content may be incorrect.
The Training Process
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Fitting a Model to the Data: Simplified Gradient Descent
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Fitting a Model to the Data: Simplified Gradient Descent
A Parameter Optimization Algorithm
Start with initial parameter values.
Repeat:
1.Measure the current error.
2.For each parameter:
Try increasing it.
Try decreasing it.
Keep the direction that reduces the error.
3.Update all parameters in their chosen directions.
Continue until the error cannot be reduced further.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
The Forest Ranger Example
A cartoon of a child in a forest

AI-generated content may be incorrect.
The forest national office asks you to give statistics about the distribution of height of trees in the forest
Context
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Striking Insight: The Correlation Between Height and Diameter
A line of trees with white tops

AI-generated content may be incorrect.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Building the Dataset, One Tree at a Time…
A cartoon of a person measuring a tree

AI-generated content may be incorrect.
A drawing of a person measuring a tree

AI-generated content may be incorrect.
A cartoon of a forest ranger writing on a book

AI-generated content may be incorrect.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Building the Dataset, One Tree at a Time…
A cartoon of a person measuring a tree

AI-generated content may be incorrect.
A drawing of a person measuring a tree

AI-generated content may be incorrect.
A cartoon of a forest ranger writing on a book

AI-generated content may be incorrect.
A black and white drawing of a person lying in a forest

AI-generated content may be incorrect.
A Pattern in the Data?
HOW MACHINES LEARN SESSION 2 A Pattern in the Data?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
A Regression Problem: Predict the Height from Diameter
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Fitting a Model to the Data
A diagram of a number of dots

AI-generated content may be incorrect.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Linear Regression: Two Parameters to Fit a Line
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Linear Regression: Finding the Optimal Parameters
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Complex Model Regression: Finding the Optimal Parameters
Linear Regression: Finding the Optimal Parameters
HOW MACHINES LEARN SESSION 2 Linear Regression: Finding the Optimal Parameters
Linear Regression: Finding the Optimal Parameters
HOW MACHINES LEARN SESSION 2 Linear Regression: Finding the Optimal Parameters Models Average Error Model 1 3.93 Model 2 3.89 Model 3 0.0
Best Fit Is Not Always the Best Model:
HOW MACHINES LEARN SESSION 2 Best Fit Is Not Always the Best Model: A case of overfitting
Best Fit Is Not Always the Best Model:
HOW MACHINES LEARN SESSION 2 Best Fit Is Not Always the Best Model: A case of overfitting 16m 23m 30m
Best Fit Is Not Always the Best Model:
HOW MACHINES LEARN SESSION 2 Best Fit Is Not Always the Best Model: A case of overfitting 16m 23m 30m
Best Fit Is Not Always the Best Model:
HOW MACHINES LEARN SESSION 2 Best Fit Is Not Always the Best Model: A case of overfitting The model learned all pairs by heart! It has not learned general rule! 23m
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Overfitting in Classification
Overfitting can also occur in classification when the decision boundary starts memorizing individual training examples rather than learning the general pattern.
018 PyTorch - Popular techniques to prevent the Overfitting in a Neural  Networks
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Overfitting in Classification
018 PyTorch - Popular techniques to prevent the Overfitting in a Neural  Networks
Informatics is the automated processing of data.
DEFINITION
Overfitting
Overfitting occurs when a model learns the training examples too closely instead of learning a general pattern that works on new data.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
When the model is too simple…
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
When the model is too simple…
018 PyTorch - Popular techniques to prevent the Overfitting in a Neural  Networks
Informatics is the automated processing of data.
DEFINITION
Underfitting
Underfitting occurs when a model is too simple to learn the underlying pattern, so it performs poorly even on its training data.
018 PyTorch - Popular techniques to prevent the Overfitting in a Neural  Networks
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Underfitting, Overfitting and Optimal Fitting
018 PyTorch - Popular techniques to prevent the Overfitting in a Neural  Networks
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Back to Overfitting: How to select the best model?
Models
Average Error
Model 1
3.93
Model 2
3.89
Model 3
0.0
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
What would you do to know the model that best generalizes on unseen trees?
Models
Average Error
Model 1
3.93
Model 2
3.89
Model 3
0.0
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Introducing the Test Set
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Introducing the Test Set
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Neural Network Training: From Underfitting to Overfitting
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
How to select the best iteration?
If the neural network can be overtrained, how to stop at optimal iteration?
018 PyTorch - Popular techniques to prevent the Overfitting in a Neural  Networks
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Proposal: Use the test set
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Proposal: Use the test set
Did the test set only evaluate our result, or did it influence it?
We used the test error to choose when to stop training and therefore which parameter values to keep.
Information from the test set flowed into our final parameters.
The test error is therefore no longer an independent estimate of performance on unseen data.
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
How to select the best iteration?
Where should the feedback come from?
The training data?
The test data?
Another separate subset of data?
Another model?
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Introducing the Validation Set
sciencespo-logo-white.png
HOW MACHINES LEARN
SESSION 2
Wrapping-Up
A useful model does more than fit the training data, it generalizes.
LEARNING
GENERALIZATION
LEARNING USES DIFFERENT SIGNALS
Labels, hidden structure, self-generated targets or rewards can guide learning.
LOSS TURNS ERRORS INTO FEEDBACK
It measures how far predictions are from the desired behaviour.
OPTIMIZATION UPDATES PARAMETERS
Training repeats prediction → error → update to improve the model.
FITTING IS NOT GENERALIZING
Low training error does not guarantee performance on unseen data.
CAPACITY CREATES A TRADE-OFF
Too little capacity underfits; too much can overfit.
DATA SPLITS HAVE DISTINCT ROLES
Train fits, validation selects. The test set evaluates once, when the model is finished without influencing it.