0% ont trouvé ce document utile (0 vote)
56 vues56 pages

Aziz Khamjane

Transféré par

mohamed Sabbar
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
56 vues56 pages

Aziz Khamjane

Transféré par

mohamed Sabbar
Copyright
© © All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF, TXT ou lisez en ligne sur Scribd

Aziz KHAMJANE

Réseau de neurones artificiels


• Des algorithmes essayant d'imiter le cerveau humain
Neurone biologique
Neurone formel

𝑥1

𝑥2 ℎ𝜃 (𝑥)

𝑥3
𝑛

𝑦 = 𝑔 ෍ 𝑤𝑖 𝑥𝑖 + 𝑏
𝑖=1
Perceptron: exemple 1 x1
0
x2
0
Y
0
0 1 0
𝑦 = 𝑥1 𝑒𝑡 𝑥2 𝑥2 1 0 0
𝑏 1 1 1

𝑥1 ℎ𝑤 (𝑥)

𝑥2 𝑥1

𝑤1 = 10 𝑤2 = 10 𝑏 = −15 x1 X2 𝑧 ℎ𝑤 (𝑥) 𝑦ො
𝑛 0 0 𝑧 = 0 × 10 + 0 × 10 − 15 = −15 0,0000003 0
𝑦 = 𝑔 ෍ 𝑤𝑖 𝑥𝑖 + 𝑏 0 1 𝑧 = 0 × 10 + 1 × 10 − 15 = −5 0,00669 0
𝑖=1 1 0 -𝑧 = 1 × 10 + 0 × 10 − 15 = −5 0,00669 0
1 1 1 𝑧 = 1 × 10 + 1 × 10 − 15 = 5 0,99330 1
𝑔 𝑧 =
1 + 𝑒 −𝑧
Perceptron : exemple 2 x1 x2 Y
0 0 0
0 1 1
𝑦 = 𝑥1 𝑜𝑢 𝑥2 𝑥2 1 0 1
𝑏 1 1 1

𝑥1 ℎ𝑤 (𝑥)

𝑥2 𝑥1

𝑤1 = 15 𝑤2 = 15 𝑏 = −10 x1 X2 𝑧 ℎ𝑤 (𝑥) 𝑦ො
𝑛 0 0 𝑧 = 0 × 15 + 0 × 15 − 10 = −10 0,000045 0
𝑦 = 𝑔 ෍ 𝑤𝑖 𝑥𝑖 + 𝑏 0 1 𝑧 = 0 × 15 + 1 × 15 − 10 = 5 0,9933 1
𝑖=1 1 0 𝑧 = 1 × 15 + 0 × 15 − 10 = 5 0,9933 1
1 1 1 𝑧 = 1 × 15 + 1 × 15 − 10 = 20 0,99999 1
𝑔 𝑧 =
1 + 𝑒 −𝑧
Perceptron : exemple 3 x1 x2 Y
0 0 1
0 1 0
𝑦 = 𝑛𝑜𝑛 𝑥1 𝑒𝑡 𝑛𝑜𝑛(𝑥2) 𝑥2 1 0 0
𝑏 1 1 0

𝑥1 ℎ𝑤 (𝑥)

𝑥2 𝑥1

𝑤1 = −15 𝑤2 = −15 𝑏 = 10
x1 X2 𝑧 ℎ𝑤 (𝑥) 𝑦ො
𝑛 0 0 𝑧 = 0 × −15 + 0 × −15 + 10 = 10 0,999954 1
𝑦 = 𝑔 ෍ 𝑤𝑖 𝑥𝑖 + 𝑏 0 1 𝑧 = 0 × −15 + 1 × −15 + 10 = −5 0,006692 0
𝑖=1 1 0 𝑧 = 1 × −15 + 0 × −15 + 10 = −5 0,06692 0
1 1 1 𝑧 = 1 × −15 + 1 × −15 + 10 = −20 0,00000002 0
𝑔 𝑧 =
1 + 𝑒 −𝑧
Problème non linéairement séparable

𝑦 = 𝑥1 𝑋𝑁𝑂𝑅 𝑥2 x1 x2 Y
0 0 1
0 1 0
𝑥2 1 0 0
𝑏 1 1 1

𝑥1 ℎ𝑤 (𝑥)

𝑥2 𝑥1
Fonction de Heaviside :
1 𝑠𝑖 𝑧 ≥ 0
𝑔 𝑧 =ቊ
0 𝑠𝑖 𝑧 < 0

Fonction signe:
1 𝑠𝑖 𝑧 ≥ 0
𝑔 𝑧 =ቊ
−1 𝑠𝑖 𝑧 < 0
Fonction linéaire par
morceaux
:
𝑎 𝑠𝑖 𝑧 > 𝑎
𝑔 𝑧 = ቐ𝑧 𝑠𝑖 − 𝑎 ≤ 𝑧 ≤ 𝑎
−𝑎 𝑠𝑖 𝑧 < −𝑎

Fonction linéaire:
𝑔 𝑧 =𝑧
Fonction sigmoïde

1
𝑔 𝑧 =
1 + 𝑒 −𝛽𝑧
Tangente hyperbolique
1 − 𝑒 −𝛽𝑧
𝑔 𝑧 =
1 + 𝑒 −𝛽𝑧
Relu
𝑔 𝑧 = max(0, 𝑧)
Architecture d’un réseau de neurones

• La couche d’entrée
• Les couches cachées
• La couche de sortie

𝑥1

𝑥2 ℎ𝑤 (𝑥)

𝑥3
Réseau de neurones:
propagation

1
𝑥1 𝑤11
(1)
𝑎1
1
𝑤12
1 ℎ𝑤 (𝑥)
𝑤13 (2)
𝑎1
𝑥2

(1)
𝑎2

𝑥3

(1) 1 1 1 1
𝑎1 = 𝑔 𝑤11 𝑥1 + 𝑤12 𝑥2 + 𝑤13 𝑥3 + 𝑏1
Réseau de neurones:
propagation

𝑥1
(1)
𝑎1
1
𝑤21

(2)
ℎ𝑤 (𝑥)
𝑥2 1
𝑤2𝟐 𝑎1

(1)
1
𝑤2𝟑 𝑎2

𝑥3

(1) 1 1 1 1
𝑎2 = 𝑔 𝑤21 𝑥1 + 𝑤22 𝑥2 + 𝑤23 𝑥3 + 𝑏2
Réseau de neurones:
propagation

𝑥1 (1)
𝑎1 𝟐
𝑤11

(2) ℎ𝑤 (𝑥)
𝑎1
𝑥2 𝟐
𝑤1𝟐
(1)
𝑎2

𝑥3

(𝟐) 2 (1) 2 (1) 2


𝒂𝟏 = 𝑔 𝑤10 𝑎1 + +𝑤12 𝑎2 + 𝑏1
Réseau de neurones:
propagation
𝑥1
(1) (1) 1 1 1 1
𝑎1 𝑎1 = 𝑔 𝑤11 𝑥1 + 𝑤12 𝑥2 + 𝑤13 𝑥3 + 𝑏1

(2)
ℎ𝑤 (𝑥) (1) 1 1 1 1
𝑎1 𝑎2 = 𝑔 𝑤21 𝑥1 + 𝑤22 𝑥2 + 𝑤23 𝑥3 + 𝑏2
𝑥2

(1) (𝟐) 2 (1) 2 (1) 2


𝑎2 𝒂𝟏 = 𝑔 𝑤11 𝑎1 + 𝑤12 𝑎2 + 𝑏1

𝑥3
(𝐿)
𝑎𝑖 est la sortie du neurone i de la couche L (la couche d’entré est la couche 0)
𝑤 (𝑘) est la matrice des poids des connexions entre les neurones de la couche
k-1 et la couche k.
1
𝑤𝑖𝑗 est le poids synaptique qui connecte le jème neurone de la couche 0 et le
ième neurone de la couche 1
Réseau de neurones:
propagation

𝑥1
(1)
𝑎1
(2) ℎ𝑤 (𝑥)
𝑥2 𝑎1
(1)
𝑎2
𝑥3

(1) 1 1 1 1
𝑍1 = 𝑤11 𝑥1 + 𝑤12 𝑥2 + 𝑤13 𝑥3 + 𝑏1 (1) (1)
(1) 𝑔 𝑍1
𝑍1 𝑎1
𝑍 (1) = (1)
𝑎(1) = (1)
= (1)
(1) 1 1 1 1
𝑍2 𝑎2 𝑔 𝑍2
𝑍2 = 𝑤21 𝑥1 + 𝑤22 𝑥2 + 𝑤23 𝑥3 + 𝑏2

(2) 2 (1) 2 (1) 2 (2) (2)


𝑍1 = +𝑤11 𝑎1 + 𝑤12 𝑎2 + 𝑏1 ℎ𝑤 𝑥 = 𝑎1 = 𝑔 𝑍1
Réseau de neurones
propagation
𝑥1
(1)
𝑎1
1 1 1 (1)
(2) ℎ𝑤 (𝑥) (1)
𝑤11 𝑤12 𝑤13 𝑏1
𝑎1 𝑊 = 𝑏 (1) =
𝑥2 1
𝑤21
1
𝑤22
1
𝑤23 (1)
𝑏2
(1)
𝑎2
𝑥3

(1) 1 1 1 1
𝑍1 = 𝑤11 𝑥1 + 𝑤12 𝑥2 + 𝑤13 𝑥3 + 𝑏1 (1)
𝑍1
𝑍 (1) = (2)
= 𝑊 (1) 𝑥 + 𝑏 (1)
(1)
𝑍2 =
1
𝑤21 𝑥1 +
1
𝑤22 𝑥2 +
1
𝑤23 𝑥3 + 𝑏2
1 𝑍2

0
𝑥1 𝑎1 (1) (2)
𝑎1 𝑔(𝑍1 )
𝑥 = 𝑥2 = 𝑎20 = 𝑎(0) 𝑍 (1) = 𝑊 (1) 𝑎(0) + 𝑏 (1) 𝑎(1) = (1)
= (2)
𝑥3 (0)
𝑎2 𝑔(𝑍2 )
𝑎3
Réseau de neurones:
propagation

𝑥1
(1)
𝑎1
(2) ℎ𝑤 (𝑥)
𝑎1
𝑥2
(1)
𝑎2
𝑥3

(1)
𝑎1 (2)
𝑎(1) = (1)
𝑊 (2) = 𝑤112 2
𝑤12 𝑏 (2) = 𝑏1
𝑎2

(2) (2) (2) (2)


𝑍1 = 𝑊 (2) 𝑎(1) + 𝑏 (2) 𝑍 (2) = 𝑍1 ℎ𝑤 𝑥 = 𝑎1 = 𝑔 𝑍1
Réseau de neurones
𝑥1
(1)
𝑎1
(2)
𝑎1 ℎ𝑤 (𝑥)
𝑥2

(1)
𝑎2
𝑥3

1 1 1 (1) (1)
𝑤11 𝑤12 𝑤13 𝑏1 𝑍1
𝑊 (1) = 1 1 1
𝑏 (1) = (1) 𝑍 (1) = = 𝑊 (1) 𝑥 + 𝑏(1) 𝑎(1) = 𝑔(𝑍 (1) )
𝑤21 𝑤22 𝑤23 𝑏2 (1)
𝑍2

𝑊 (2) = 2 2
𝑏 (2) = 𝑏1
(2) (2)
𝑍1 = 𝑊 (2) 𝑎(1) + 𝑏 (2) 𝑎(2) = 𝑔(𝑍 (2) )
𝑤11 𝑤12
Réseau de neurones:
propagation
𝑎(0) = 𝑋

𝑍 (1) = 𝑊 (1) 𝑎(0) + 𝑏 (0) 𝑎(1) = 𝑔(𝑍 (1) )

𝑍 (2) = 𝑊 (2) 𝑎(1) + 𝑏 (2) 𝑎(2) = 𝑔(𝑍 (2) )

𝑍 (𝐿) = 𝑊 (𝐿) 𝑎(𝐿−1) + 𝑏 (𝐿) 𝑎(𝐿) = 𝑔(𝑍 (𝐿) )


Réseau de neurones.
Exemple
1
𝑋= 𝑎(0) =
0
0,4 0,5 0,2
𝑊 (1) = 0,6 0,7 𝑏 (1) = 0,3
0,8 0,3 0,4

0,6 0,2 0,7 0,7


𝑊 (2) = 𝑏 (2) =
0,7 0,2 0,8 0,3

𝑊 (3) = 0,8 0,5 𝑏 (3) = 0,1

La fonction d’activation utilisée dans les deux couches cachées est la fonction tanh
La fonction d’activation utilisée dans la couche de sortie est la fonction sigmoide
Réseau de neurones.
Exemple
1
𝑋= 𝑎(0) =
0

0,4 0,5 0,2


1
𝑍 (1) = 𝑊 (1) 𝑎(0) + 𝑏 (1) = 0,6 0,7 + 0,3
0
0,8 0,3 0,4

0,6 𝑔(0,6) tanh(0,6) 0,537


𝑍 (1) = 0,9 𝑎(1) = 𝑔(0,9) = tanh(0,9) = 0,716
1,2 𝑔(1,2) tanh(1,2) 0,833

0,537
𝑎(1) = 0,716
0,833
Réseau de neurones.
Exemple

0,537
𝑎 (1) = 0,716
0,833

0,537
0,6 0,2 0,7 0,7
𝑍 (2) = 𝑊 (2) 𝑎(1) + 𝑏 (2) = 0,716 +
0,7 0,2 0,8 0,3
0,833

1,749 𝑔 1,749 tanh 1,749 0,941


𝑍 (2) = = =
1,486 𝑔 1,486 tanh 1,486 0,902

0,941
𝑎(2) =
0,902
Réseau de neurones : propagation
Exemple

0,941
𝑍 (3) = 𝑊 (3) 𝑎(2) + 𝑏 (3) = 0,8 0,5 + 0,1
0,902

𝑍 (3) = 1,29 𝑔 1,29 = σ 1,29 = 0,72

ℎ𝑤 𝑥 = 𝑎(3) = 0,784
Perceptron multicouches
𝑏 𝑦 = 𝑥1 𝑋𝑁𝑂𝑅 𝑥2
-15

𝑥1 10 ℎ𝑤 (𝑥) 𝑦 = 𝑥1 𝑒𝑡 𝑥2 𝑥2 x1 x2 Y
10 0 0 1
𝑥2 0 1 0
1 0 0
𝑏 1 1 1
10

𝑥1 -15 ℎ𝑤 (𝑥) 𝑦 = 𝑛𝑜𝑛 𝑥1 𝑒𝑡 𝑛𝑜𝑛(𝑥2)


-15
𝑥1
𝑥2
𝑏
-10

𝑥1 15 ℎ𝑤 (𝑥) 𝑦 = 𝑥1 𝑜𝑢 𝑥2
15
𝑥2
Perceptron multicouches : propagation 𝑦 = 𝑥1 𝑋𝑁𝑂𝑅 𝑥2
x1 x2 Y
𝑥2 0 0 1
0 1 0

(1)
1 0 0
𝑏 1 1 1
-10 𝑥1
-15
𝑦 = 𝑥1 𝑒𝑡 𝑥2
10
(1) 15
𝑎1 (2)
10
𝑎1 𝑥1 𝑥2 (1) (1) (2)
𝑎1 𝑎2 𝑎1
10 15 𝑦 = 𝑥1 𝑜𝑢 𝑥2 0 0 0 1 1
𝑥1
-15 0 1 0 0 0
(1) 1 0 0 0 0
𝑎2
-15 1 1 1 0 1
𝑥2 𝑦 = 𝑛𝑜𝑛 𝑥1 𝑒𝑡 𝑛𝑜𝑛(𝑥2)
Sortie désirée

A B C D

C
0,2
0,5
𝑦=
0,8
0,1
Fonction cout

𝑚 𝑆𝐿
1 𝑖 𝑖 𝑖
J 𝑊, 𝑏 = − ෍ ෍ 𝑦𝑗 log ℎ𝑤 𝑥 𝑗 + 1 − 𝑦𝑗 log 1 − ℎ𝑤(𝑥 𝑖 )
𝑚 𝑗
𝑖=1 𝑗=1

𝑆𝐿 est le nombre de neurones de la couche de sortie

ℎ𝑤 𝑥 𝑖 est la sortie du neurone j de la couche de sortie


𝑗
Fonction cout

𝑚
1 𝑖
2
J 𝑊, 𝑏 = − ෍ ℎ𝑤 , 𝑏 𝑥 − 𝑦𝑗
2𝑚 𝑗
𝑖=1
min J 𝑊, 𝑏
𝑊
Aziz KHAMJANE
Apprentissage du réseau de neurones

𝑚 𝑘
1 𝑖
2
J 𝑊, 𝑏 = − ෍ ෍ ℎ𝑤 𝑥 − 𝑦𝑗
2𝑚 𝑗
𝑖=1 𝑗=1
min J 𝑊, 𝑏
𝑊,𝑏
Calcul
1
de l’erreur
𝑥= 1
0 𝑏
2
𝑏
-0,5 0,5
0,2

Calculer la sortie de ce réseau sachant que


(1) 0,3 (2) la fonction d’activation utilisée est la
0,5
𝑎1 𝑎1 fonction sigmoide.
0,8 0,8
𝑥1
-0,4
(1)
𝑎2
-0,6
𝑥2
Calcul de l’erreur
𝑏 1
1 0,5 0,8 1 −0,5
𝑥= 2 𝑍 (1) = 𝑊 (1) 𝑎(0) + 𝑏 (1) = +
0 𝑏 −0,4 0,6 0 0,2

-0,5 0,5
0,2 0 σ 0 0,5
𝑍 (1) = σ −0,2
=
0,45
−0,2
(1) 0,3 (2) 0,5
𝑎1 𝑎1 𝑎(1) =
0,5 0,45
0,8 0,8
𝑥1
-0,4
(1)
𝑎2
-0,6
𝑥2
Calcul de l’erreur
𝑏 1
1
𝑥= 2
0 𝑏
-0,5 0,5 0,5
0,2 𝑎(1) =
0,45
(1) 0,3 (2)
0,5
𝑎1 𝑎1
0,8 0,8
𝑥1
-0,4 0,5
𝑍 (2) = 𝑊 (2) 𝑎(1) + 𝑏 (2) = 0,3 0,8 + 0,5 = 1,035
(1) 0,45
𝑎2
-0,6
𝑥2
𝑎(2) = 𝜎 1,035 = 0,73
Calcul de l’erreur
1 𝑎(2) = 𝜎 1,01 = 0,73
𝑥=
1 𝑏
2
0 𝑏
-0,5 0,5
0,2

(1) 0,3 (2)


0,5
𝑎1 𝑎1
0,8 0,8
𝑥1
-0,4
(1)
𝑎2
-0,6
𝑥2
Sachant que la sortie désirée est 0, alors l’erreur est :
1 2 1 2 1
J 𝑊, 𝑏 = σ𝑚 ℎ𝑤 𝑥 𝑖 − 𝑦𝑗 = 𝑎1 − 𝑦 2 = 0,73 − 0 2 = 0,266
2𝑚 𝑖=1 2 2
Règle de mise à jour des poids
1
𝑏
𝑏 2 (𝑙) (𝑙) 𝜕 𝐽(𝑊, 𝑏)
𝑤𝑖𝑗 = 𝑤𝑖𝑗 −𝛼 (𝑙)
-0,5
𝜕𝑤𝑖𝑗
0,5
0,2

(1)
𝑎1
0,3 (2)
𝑎1 (2) (2) 𝜕 𝐽(𝑊, 𝑏)
0,5 𝑤11 = 𝑤11 −𝛼 (2)
0,8 𝜕𝑤11
0,8
𝑥1
-0,4
(1)
𝑎2 (𝑙) (𝑙) 𝜕 𝐽(𝑊, 𝑏)
-0,6 𝑏𝑗 = 𝑏𝑗 −𝛼
𝑥2 (𝑙)
𝜕𝑏𝑗
Calcul des des dérivées partielles
1
𝑏 2 (2) (2) 𝜕 𝐽(𝑊)
𝑏 𝑤11 = 𝑤11 −𝛼 (2)
𝜕𝑤11
-0,5 0,5
0,2
(2) (2)
(1) 0,3 (2) 𝜕 𝐽(𝑊) 𝜕𝐽(𝑊) 𝜕𝑎1 𝜕𝑧1
0,5
𝑎1 𝑎1 (2)
= (2) (2) (2)
0,8
𝜕𝑤11 𝜕𝑎1 𝜕𝑧1 𝑤11
0,8
𝑥1
-0,4
(1)
𝑎2
𝑥2 -0,6
Calcul des dérivés partielles
(2) (2)
𝜕 𝐽(𝑊) 𝜕𝐽(𝑊) 𝜕𝑎1 𝜕𝑧1
𝑏 1 (2)
= (2) (2) (2)
2 𝜕𝑤11 𝜕𝑎1 𝜕𝑧1 𝑤11
𝑏
-0,5
0,2 0,5 𝜕𝐽(𝑊) 𝜕 1 (2) 2 (2)
= 𝑎 −𝑦 = 𝑎1 − 𝑦
𝜕𝑎1
(2)
𝜕𝑎1
(2) 2 1
(1) 0,3 (2)
0,5
𝑎1 𝑎1 1
(2) 2 𝜕 (2)
0,8 0,8 𝜕𝑎1 𝜕𝜎(𝑧1 ) 1+𝑒 −𝑧1
𝑥1 (2)
= (2)
= (2)
2
= 𝑎1 (1 − 𝑎1 )
2
-0,4 𝜕𝑧1 𝜕𝑧1 𝜕𝑧1
(1)
𝑎2
𝑥2 -0,6 𝜕𝑧1
(2) 2 1
𝜕(𝑤11 𝑎1 + 𝑤12 𝑎2 + 𝑏1 )
2 1 (2)
(1)
(2)
= (2)
= 𝑎1
𝜕𝑤11 𝜕𝑤11
𝜕𝐽(𝑊) (2) 2 2 (1)
(2)
= 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎1
𝜕𝑤11
Calcul des dérivées partielles
𝑏 1
𝑏 2
𝜕𝐽(𝑊) (2) 2 2 (1)
-0,5 0,5 (2)
= 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎1
0,2 𝜕𝑤11

(1) 0,3 (2) 𝜕𝐽(𝑊)


0,5 𝑎1 𝑎1 (2) 2
= 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎2
2 (1)
(2)
𝜕𝑤12
𝑥1 0,8
0,8
-0,4
(1) 𝜕𝐽(𝑊) (2) 2 2
𝑎2 (2)
= 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 ) × 1
𝜕𝑏1
𝑥2 -0,6
(2)
Mise à jour des poids 𝑤𝑖𝑗
1
𝑥 = 𝑎(0) =
0

𝑏 1
𝑏 2
(2) (2) (2) 2 2
𝑏1 = 𝑏1 − 𝛼 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )
-0,5 0,5
0,2
(2) (2) (2) 2 2 (1)
𝑤12 = 𝑤12 − 𝛼 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎1
(1) 0,3 (2)
0,5
𝑎1 𝑎1
(2) (2) (2) 2 2 (1)
0,8 𝑤11 = 𝑤11 − 𝛼 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎2
0,8
𝑥1
-0,4
(1)
𝑎2
𝑥2 -0,6
(2)
Mise à jour des poids 𝑤𝑖𝑗
1 𝑦=0
𝑥 = 𝑎(0) = (2)
𝑏1
(2) (2) 2
= 𝑏1 − 𝛼 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )
2
0
1 0,5 (2)
𝑏 (2) = 0,5
𝑏 𝑎 (1) = 𝑎1 = 0,73 𝑤 (2) = 0,3 0,8
2 0,45
𝑏
-0,5 0,5 (2)
0,2 𝑏1 = 0,5 − 0,1 × (0,73 − 0) × 0,73 × (1 − 0,73)

(1) 0,3 (2) (2)


0,5
𝑎1 𝑎1 𝑏1 = 0,5 − 0,014 = 0,485
0,8 0,8 (2)
𝑥1 𝑤11 = 0,3 − 0,1 × (0,73 − 0) × 0,73 × (1 − 0,73) × 0,5
-0,4
(1) (2)
𝑎2 𝑤11 = 0,3 − 0,0071 = 0,292
𝑥2 -0,6
(2)
𝑤12 = 0,8 − 0,1 × (0,73 − 0) × 0,73 × (1 − 0,73) × 0,45
(2)
𝑤12 = 0,8 − 0,0064 = 0,793
(1)
Calcul des dérivées partielles de la fonction cout par rapport aux poids 𝑤𝑖𝑗

1
𝜕𝐽(𝑊)
𝑏 2 (1)
𝑏 𝜕𝑤𝑖𝑗
-0,5 0,5
0,2 (2) (2) (1) (1)
𝜕𝐽(𝑊) 𝜕𝐽(𝑊) 𝜕𝑎1 𝜕𝑧1 𝜕𝑎1 𝜕𝑧1
(1) 0,3 (2) (1) = (2) × (2) × (1) × (1) × (1)
0,5
𝑎1 𝑎1 𝜕𝑏1 𝜕𝑎1 𝜕𝑧1 𝜕𝑎1 𝜕𝑧1 𝜕𝑏1
0,8 0,8
𝑥1 (2)
𝜕𝑎1
(2)
𝜕𝑧1
(1)
𝜕𝑎1
(1)
𝜕𝑧1
-0,4 𝜕𝐽(𝑊) 𝜕𝐽(𝑊)
(1)
𝑎2 (1) = (2) × (2) × (1) × (1) × (1)
𝜕𝑤11 𝜕𝑎1 𝜕𝑧1 𝜕𝑎1 𝜕𝑧1 𝜕𝑤11
𝑥2 -0,6
(1)
Calcul des dérivées partielles de la fonction cout par rapport aux poids 𝑤𝑖𝑗
(2) (1) (1) (2)
𝜕𝐽(𝑊) 𝜕𝐽(𝑊) 𝜕𝑎1 𝜕𝑧1 𝜕𝑎1 𝜕𝑧1
𝑏 1 (1) = (2) × (2) × (1) × (1) × (1)
2 𝜕𝑏1 𝜕𝑎1 𝜕𝑧1 𝜕𝑎1 𝜕𝑧1 𝜕𝑏1
𝑏
(2)
-0,5 𝜕𝐽(𝑊) 𝜕𝑎1 (2) 2 2
0,2 0,5 (2)
× (2)
= 𝑎1 − 𝑦 𝑎1 1 − 𝑎1
𝜕𝑎1 𝜕𝑧1
(1) 0,3 (2) (2) 2 1 2 1 2
0,5
𝑎1 𝑎1 𝜕𝑧1
=
𝜕(𝑤11 𝑎1 + 𝑤12 𝑎2 + 𝑏1 )
= 𝑤11
(2)
(1) (2)
0,8 𝜕𝑎1 𝜕𝑎1
𝑥1 0,8
-0,4 (1)
(1) 𝜕𝑎1 1 1
𝑎2 (1)
= 𝑎1 (1 − 𝑎1 )
𝜕𝑧1
𝑥2 -0,6
(1) 1 0 1 0 2
𝜕𝑧1 𝜕(𝑤11 𝑎1 + 𝑤12 𝑎2 + 𝑏1 )
(1)
= (1)
=1
𝜕𝑏1 𝜕𝑏1
𝜕𝐽(𝑊) 2 2 2 2 1 1
(1)
= 𝑎1 − 𝑦 𝑎1 1 − 𝑎1 𝑤11 𝑎1 1 − 𝑎1 1
𝜕𝑏1
(1)
Calcul des dérivées partielles de la fonction cout par rapport aux poids 𝑤𝑖𝑗

𝜕𝐽(𝑊) 2 2 2 2 1 1
(1)
= 𝑎1 − 𝑦 𝑎1 1 − 𝑎1 𝑤11 𝑎1 1 − 𝑎1 1
1 𝜕𝑏1
𝑏 2
𝑏 𝜕𝐽(𝑊) (2) (2) (0)
2 2 1 1
(1)
= 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑤11 𝑎1 1 − 𝑎1 𝑎1
-0,5 0,5 𝜕𝑤11
0,2
𝜕𝐽(𝑊) (2) 2 2 (2) 1 1 (0)
(1) 0,3 (2) = 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑤11 𝑎1 1 − 𝑎1 𝑎2
0,5
𝑎1 𝑎1 (1)
𝜕𝑤12
(0) 0,8 0,8 𝜕𝐽(𝑊)
𝑎1 2
= 𝑎1 − 𝑦 𝑎1
2 2
1 − 𝑎12 𝑤12 𝑎2
1
1 − 𝑎2
1
1
-0,4 (1)
(1) 𝜕𝑏2
𝑎2
(0) -0,6 𝜕𝐽(𝑊)
𝑎2 (2) 2 2
= 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑤12 𝑎2
(2) 1
1 − 𝑎2
1 (0)
𝑎1
(1)
𝜕𝑤21
𝜕𝐽(𝑊) (2) 2 2 (2) 1 1 (0)
(1)
= 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑤12 𝑎2 1 − 𝑎2 𝑎2
𝜕𝑤22
Rétropropagation
La fonction cout utilisée est l’erreur quadratique moyenne (sans
utilisation du terme de régularisation)

L’erreur sur le neurone j de la couche de sortie est définie par :


(𝐿) (𝐿) (𝐿)
𝛿𝑗 = 𝑎𝑗 − 𝑦𝑗 𝑔′ 𝑧𝑗

(𝐿)
𝛿 (𝐿) = 𝑎(𝐿) − 𝑦 .∗ 𝑔′ 𝑧 (𝐿) Vecteur des 𝛿𝑗

L’erreur sur les neurones des couches cachées peut être définie par :
𝑇 (𝑙+1)
𝛿 (𝑙) = 𝑤 (𝑙+1) 𝛿 .∗ 𝑔′ 𝑧 (𝑙)

Les dérivées partielles peuvent être définies par :


𝜕𝐽(𝑊) 𝜕𝐽(𝑊) (𝑙)
(𝑙−1) (𝑙) = 𝛿𝑖
(𝑙)
= 𝑎𝑗 𝛿𝑖 (𝑙)
𝜕𝑤𝑖𝑗 𝜕𝑏𝑗
Rétropropagation

𝑏 1
𝑏 2

-0,5 0,5
0,2
𝛿 (𝐿) = 𝑎(𝐿) − 𝑦 .∗ 𝑔′ 𝑧 (𝐿)
(1) 0,3 (2)
0,5
𝑎1 𝑎1 𝛿 (2) = 𝑎(2) − 𝑦 .∗ 𝑔′ 𝑧 (2)
0,8 0,8
𝑥1
-0,4 (2) (2) (2) (2)
(1) 𝛿1 = 𝑎1 −𝑦 𝑎1 1− 𝑎1
𝑎2
𝑥2 -0,6
Rétropropagation
1
𝑏 2
𝑏 𝜕𝐽(𝑊) (2) 2 2 (1)
(2)
= 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎1
-0,5 𝜕𝑤11
0,2 0,5

(1) 0,3 (2)


0,5 𝑎1 𝑎1
0,8
𝑥1 0,8
-0,4
(1)
𝑎2
𝑥2 -0,6

(2) (2) (2) (2)


𝛿1 = 𝑎1 − 𝑦 𝑎1 1 − 𝑎1
𝛿 (2) = 𝑎(2) − 𝑦 .∗ 𝑔′ 𝑧 (2)

𝜕𝐽(𝑊) (𝑙−1) (𝑙) 𝜕𝐽(𝑊) (1) (2) (1) (2) (2) (2)
(𝑙)
= 𝑎𝑗 𝛿𝑖 = 𝑎1 𝛿1 = 𝑎1 𝑎1 − 𝑦 𝑎1 1 − 𝑎1
(2)
𝜕𝑤𝑖𝑗 𝜕𝑤11
Rétropropagation
𝑏1 2
𝑏
-0,5 𝛿 (2) = 𝑎(2) − 𝑦 .∗ 𝑔′ 𝑧 (2)
0,2 0,5
(2) (2) (2) (2)
(1) 0,3 (2)
𝛿1 = 𝑎1 − 𝑦 𝑎1 1 − 𝑎1
0,5 𝑎1 𝑎1
𝑇 (𝑙+1)
𝑥1 0,8 0,8 𝛿 (𝑙) = 𝑤 (𝑙+1) 𝛿 .∗ 𝑔′ 𝑧 (𝑙)
-0,4
(1) 𝑇 (2)
𝑎2 𝛿 (1) = 𝑤 (2) 𝛿 .∗ 𝑔′ 𝑧 (1)
𝑥2 -0,6

2 (1) (1)
𝑤11 (2) (2) (2)
𝑎1 1 − 𝑎1
𝛿 (1) = 2
𝑎1 − 𝑦 𝑎1 1 − 𝑎1 .∗ (1) (1)
𝑤12 𝑎2 1 − 𝑎2

(1) (2) (2) 2 2 (1) (1)


𝛿1 𝑤11 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎1 1 − 𝑎1
(1)
= (2) (2) 2 2 (1) (1)
𝛿2 𝑤12 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎2 1 − 𝑎2
Rétropropagation
𝑏1 2
𝑏
-0,5
0,2 0,5
(1) (2) (2) 2 2 (1) (1)
(1) 0,3 (2) 𝛿1 𝑤11 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎1 1 − 𝑎1
0,5 𝑎1 𝑎1 (1)
= (2) (2) 2 2 (1) (1)
𝛿2 𝑤12 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎2 1 − 𝑎2
0,8
𝑥1 0,8
-0,4
(1)
𝑎2
𝑥2 -0,6

𝜕𝐽(𝑊) (𝑙) 𝜕𝐽(𝑊) (1) (2) (2) 2 2 (1) (1)


(𝑙)
= 𝛿𝑖 (1)
= 𝛿1 = 𝑤11 𝑎1 − 𝑦 𝑎1 1 − 𝑎1 𝑎1 1 − 𝑎1
𝜕𝑏𝑖 𝜕𝑏1

𝜕𝐽(𝑊) (1) (0) (2) (2) 2 2 (1) (1) (0)


(1) = 𝛿1 𝑎1 = 𝑤11 𝑎1 −𝑦 𝑎1 1 − 𝑎1 𝑎1 1 − 𝑎1 𝑎1
𝜕𝐽(𝑊) (𝑙) (𝑙−1) 𝜕𝑤11
(𝑙)
= 𝛿𝑖 𝑎𝑗
𝜕𝑤𝑖𝑗 𝜕𝐽(𝑊) (1) (0) (2) (2) 2 2 (1) (1) (0)
(1) = 𝛿1 𝑎2 = 𝑤11 𝑎1 − 𝑦 𝑎1 1 − 𝑎1 𝑎1 1 − 𝑎1 𝑎2
𝜕𝑤12
Rétropropagation
𝑏1 2
𝑏
-0,5
0,2 0,5
(1) (2) (2) 2 2 (1) (1)
𝛿1 𝑤11 𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎1 1 − 𝑎1
(1) 0,3 (2) =
0,5 𝑎1 𝑎1 (1)
𝛿2 (2)
𝑤12
(2) 2
𝑎1 − 𝑦 𝑎1 (1 − 𝑎1 )𝑎2
2 (1) (1)
1 − 𝑎2
0,8
𝑥1 0,8
-0,4
(1)
𝑎2
𝑥2 -0,6

𝜕𝐽(𝑊) (𝑙) 𝜕𝐽(𝑊) (1) (2) (2) 2 2 (1) (1)


(𝑙)
= 𝛿𝑖 (1)
= 𝛿2 = 𝑤12 𝑎1 − 𝑦 𝑎1 1 − 𝑎1 𝑎2 1 − 𝑎2
𝜕𝑏𝑖 𝜕𝑏2

𝜕𝐽(𝑊) (1) (0) (2) (2) 2 2 (1) (1) (0)


(1) = 𝛿2 𝑎1 = 𝑤12 𝑎1 −𝑦 𝑎1 1 − 𝑎1 𝑎2 1 − 𝑎2 𝑎1
𝜕𝑤21
𝜕𝐽(𝑊) (𝑙) (𝑙−1)
(𝑙)
= 𝛿𝑖 𝑎𝑗 𝜕𝐽(𝑊)
𝜕𝑤𝑖𝑗 (1) (0) (2) (2) 2 2 (1) (1) (0)
(1) = 𝛿2 𝑎2 = 𝑤12 𝑎1 − 𝑦 𝑎1 1 − 𝑎1 𝑎2 1 − 𝑎2 𝑎2
𝜕𝑤22
Algorithme de rétropropagation 𝑏 1
2
𝑏
-0,5
0,2 0,5
(1) 0,3 (2)
0,5 𝑎1 𝑎1
0,8
𝑥1 0,8
Pour i =1 jusqu’à m -0,4 (1)
𝑎2
(𝑙)
∆𝑖𝑗 ← 0 𝑝𝑜𝑢𝑟 𝑡𝑜𝑢𝑡 𝑖, 𝑗 𝑒𝑡 𝑙 𝑥2 -0,6

𝑎(0) ← 𝑥
Effectuer la propagation pour calculer 𝑎(1) , 𝑎(2) , … . 𝑎(𝐿) (L est le nombre de couches -1)
En utilisant la sortie désirée 𝑦 (𝑖) (la sortie désirée de l’exemple 𝑥 (𝑖) ) calculer 𝛿 (𝐿)
Effectuer la rétropropagation pour calculer 𝛿 (𝐿−1) , 𝛿 (𝐿−2) , … . 𝛿 (2)
(𝑙) (𝑙) (𝑙) (𝑙−1)
∆𝑖𝑗 ← ∆𝑖𝑗 + 𝛿𝑖 𝑎𝑗

(𝑙) 1 (𝑙) (𝑙) 𝜕𝐽(𝑊)


𝐷𝑖𝑗 ← ∆ 𝐷𝑖𝑗 =
𝑚 𝑖𝑗 (𝑙)
𝜕𝑤𝑖𝑗

Vous aimerez peut-être aussi