Professional Documents
Culture Documents
Chapitre 4
Chapitre 4
Plan
Introduction
Régression
Arbres de décision
Apprentissage bayésien
Séparateurs a vaste marge
Réseaux de neurones artificiels
Modèles de Markov cachés
© FEZZA S. v21‐22
Apprentissage par renforcement
Machine Learning 1
Objectifs
Machine Learning 2
1
14/12/2021
Non-linear Classification
x2
x1
size
# bedrooms
# floors
age
© FEZZA S. v21‐22
Machine Learning 3
Car detection
Cars Not a car
Testing:
What is this?
© FEZZA S. v21‐22
Machine Learning 4
2
14/12/2021
Car detection
pixel 1
Learning
Algorithm
pixel 2
Raw image
pixel 2
Cars pixel 1
“Non”‐Cars
© FEZZA S. v21‐22
Machine Learning 5
Car detection
pixel 1
Learning
Algorithm
pixel 2
Raw image 50 x 50 pixel images→ 2500 pixels
pixel 2 (7500 if RGB)
pixel 1 intensity
pixel 2 intensity
pixel 2500 intensity
“Non”‐Cars features
Machine Learning 6
3
14/12/2021
Neural Networks
• Origins: Algorithms that try to mimic the brain.
• Was very widely used in 80s and early 90s; popularity diminished in late 90s.
• Recent resurgence: State‐of‐the‐art technique for many applications
© FEZZA S. v21‐22
Machine Learning 7
Neural Networks
• Origin of Neural Networks:
“Artificial neural networks (ANN) or connectionist systems
are computing systems vaguely inspired by the biological
neural networks that constitute animal brains.”
© FEZZA S. v21‐22
Machine Learning 8
4
14/12/2021
Neural Networks
• Origin of Neural Networks:
“Artificial neural networks (ANN) or connectionist systems
are computing systems vaguely inspired by the biological
neural networks that constitute animal brains.”
© FEZZA S. v21‐22
Multiple layers in a biological neural network
Machine Learning 9
Perceptron
© FEZZA S. v21‐22
Machine Learning 10
5
14/12/2021
© FEZZA S. v21‐22
Perceptron
Machine Learning 11
In this equation:
• wi, j is the connection weight between the ith input neuron and the jth output neuron.
• xi is the ith input value of the current training instance.
• ŷ j is the output of the jth output neuron for the current training instance.
• yj is the target output of the jth output neuron for the current training instance.
• η is the learning rate.
© FEZZA S. v21‐22
Machine Learning 12
6
14/12/2021
© FEZZA S. v21‐22
Neuron model: Logistic unit
Machine Learning 13
Neural Networks
© FEZZA S. v21‐22
Machine Learning 14
7
14/12/2021
Feed-Forward Process
• Input layer units are features
• Working forward through the network, the input
function is applied to compute the input value
• E.g., weighted sum of the input
• The activation function transforms this input
function into a final value
• Typically a nonlinear function (e.g, sigmoid)
© FEZZA S. v21‐22
Machine Learning 15
Neural Networks
© FEZZA S. v21‐22
Machine Learning 16
8
14/12/2021
© FEZZA S. v21‐22
Forward propagation: Vectorized implementation
Machine Learning 17
Neural Networks
• Neural Network learning its own features
Machine Learning 18
9
14/12/2021
Multilayer Perceptron
Machine Learning 19
Non-linear classification
• Example: XOR/XNOR
, are binary (0 or 1).
x2
x2
x1
x1
© FEZZA S. v21‐22
Machine Learning 20
10
14/12/2021
© FEZZA S. v21‐22
Non-linear classification
Machine Learning 21
Non-linear classification
• Example: OR function
0 0
0 1
1 0
1 1
© FEZZA S. v21‐22
Machine Learning 22
11
14/12/2021
Non-linear classification
• Example: Negation function
0
1
© FEZZA S. v21‐22
Machine Learning 23
Non-linear classification
• Putting it together: x2
x1
0 0
© FEZZA S. v21‐22
0 1
1 0
1 1
Machine Learning 24
12
14/12/2021
Want , , , etc.
© FEZZA S. v21‐22
when pedestrian when car when motorcycle
Machine Learning 25
Want , , , etc.
when pedestrian when car when motorcycle
Training set:
one of , , ,
© FEZZA S. v21‐22
pedestrian car motorcycle truck
Machine Learning 26
13
14/12/2021
Cost function
total no. of layers in network
no. of units (not counting bias unit) in
layer
Layer 1 Layer 2 Layer 3 Layer 4
Binary classification Multi‐class classification (K classes)
E.g. , , ,
pedestrian car motorcycle truck
1 output unit K output units
© FEZZA S. v21‐22
Machine Learning 27
Cost function
• Logistic regression:
• Neural network:
Need code to compute:
© FEZZA S. v21‐22
‐
‐
Machine Learning 28
14
14/12/2021
Backpropagation algorithm
• Gradient computation
Given one training example ( , ):
© FEZZA S. v21‐22
Machine Learning 29
Backpropagation algorithm
Intuition: “error” of node in layer .
For each output unit (layer L = 4)
Machine Learning 30
15
14/12/2021
Backpropagation algorithm
Set (for all ).
For
Set
Perform forward propagation to compute for
Using , compute
Compute
© FEZZA S. v21‐22
Machine Learning 31
Forward Propagation
© FEZZA S. v21‐22
Machine Learning 32
16
14/12/2021
© FEZZA S. v21‐22
Backpropagation
Machine Learning 33
Network architecture
• Pick a network architecture (connectivity pattern between
neurons)
No. of input units: Dimension of features
No. output units: Number of classes
Reasonable default: 1 hidden layer, or if >1 hidden layer, have same no. of hidden
units in every layer (usually the more the better)
© FEZZA S. v21‐22
Machine Learning 34
17
14/12/2021
1. Randomly initialize weights
2. Forward propagation to get for any
3. Compute cost function
4. Backpropagation to compute partial derivatives
5. Use gradient descent or advanced optimization method
with backpropagation to try to minimize as a function
of parameters
© FEZZA S. v21‐22
Machine Learning 35
Objectifs
Machine Learning 36
18