SlideShare a Scribd company logo
1 of 15
Download to read offline
Mult-layer perceptron
Back Propagation
Steps of a single epoch
For each pattern
• Forward prop
oCalculate 𝑛𝑒𝑡𝑗 and 𝑜𝑗 for all neurons (except input layer and bias neurons)
oCalculate specific error (for single pattern)
• Back prop
oCalculate 𝛿𝑗 for all neurons (except input layer and bias neurons)
oCalculate ∆𝑤𝑖,𝑗 for all variable weights including bias weights
o𝑤𝑖,𝑗 ≔ 𝑤𝑖,𝑗 + ∆𝑤𝑖,𝑗
After end of epoch
• Calculate total error = sum of specific errors
• Check stopping condition
• Run another epoch if stopping condition is False
Notes
• 𝑛𝑒𝑡ℎ = 𝑘∈𝐾 𝑤𝑘,ℎ 𝑜𝑘
• 𝑜ℎ = 𝑓𝑎𝑐𝑡 𝑛𝑒𝑡ℎ Default is
1
1+𝑒−𝑛𝑒𝑡
• 𝛿ℎ =
• 𝑓𝑎𝑐𝑡
′
𝑛𝑒𝑡ℎ ∙ 𝑙∈𝐿 𝛿𝑙 𝑤ℎ,𝑙 if h is hidden neuron
• Default is: 𝑜ℎ 1 − 𝑜ℎ 𝑙∈𝐿 𝛿𝑙 𝑤ℎ,𝑙 for sigmoid activation function
• 𝑓𝑎𝑐𝑡
′
𝑛𝑒𝑡ℎ ∙ −
𝜕𝐸𝑟𝑟𝑝
𝜕𝑦ℎ
if h is output neuron
• Default is: 𝑦ℎ(1 − 𝑦ℎ)(𝑡ℎ − 𝑦ℎ) for sigmoid activation function
and for 𝐸𝑟𝑟𝑝 =
1
2 ℎ∈𝐻 𝑡ℎ − 𝑦ℎ
2
Warning! if different activation function or different error function is used, you must
calculate the derivatives 𝑓𝑎𝑐𝑡
′
𝑛𝑒𝑡ℎ ∙ −
𝜕𝐸𝑟𝑟𝑝
𝜕𝑦ℎ
Assuming layer K is before layer H, and either layer L is after
layer H, or layer H is the output layer
Notes
• ∆𝑤𝑖,𝑗 = 𝜂 𝑜𝑖 𝛿𝑗
• 𝑤𝑖,𝑗 ≔ 𝑤𝑖,𝑗 + 𝜂 𝑜𝑖 𝛿𝑗
• If i is input neuron: 𝑜𝑖 = 𝑥𝑖
• If i is bias neuron: 𝑜𝑖 = 1
Example
x1 x2 t
0 0 0
0 1 1
1 0 1
1 1 0
Assume learning rate = 0.3
Epoch: 1
Pattern: 1: x1 = 0, x2 = 0, t = 0
• Initial weights:
w13 = 0.3 w23 = -0.1 wb3 = 0.2
w14 = -0.2 w24 = 0.2 wb4 = -0.3
w35 = 0.4 w45 = -0.2 wb5 = 0.4
• Forward prop:
o net3 = w13 * x1 + w23 * x2 + wb3 = 0.3 * 0 – 0.1 * 0 + 0.2 = 0.2
o o3 = 1/(1 + e^-net3) = 1/(1 + e^-0.2) = 0.5498
o net4 = w14 * x1 + w24 * x2 + wb4 = -0.2 * 0 + 0.2 * 0 – 0.3 = -0.3
o o4 = 1/(1 + e^-net4) = 1/(1 + e^0.3) = 0.4256
o net5 = w35 * o3 + w45 * o4 + wb5 = 0.4 * 0.5498 – 0.2 * 0.4256 + 0.4 = 0.5348
o y = 1/(1+e^-net5) = 1/(1+e^-0.5348) = 0.6306
• Calculating error:
o Err_p1 = 0.5 * (0 – 0.6306)^2 = 0.1988
Epoch: 1
Pattern: 1: x1 = 0, x2 = 0, t = 0
Back Prop:
1) Finding delta
δ5 = y*(1 - y)*(t - y) = 0.6306 * (1 - 0.6306) * (0 - 0.6306) = - 0.1469
δ3 = o3(1 – o3)* δ5 * w35 = 0.5498 * (1 - 0.5498) * - 0.1469 * 0.4 = - 0.0145
δ4 = o4(1 – o4)* δ5 * w45 = 0.4256 * (1 - 0.4256) * - 0.1469 * -0.2 = 0.0072
2) Finding new weights
w35 := w35 + η * o3 * δ5 = 0.4 + 0.3 * 0.5498 * - 0.1469 = 0.3758
w45 := w45 + η * o4 * δ5 = -0.2 + 0.3 * 0.4256 * - 0.1469 = -0.2188
wb5 := wb5 + η * 1 * δ5 = 0.4 + 0.3 * 1 * - 0.1469 = 0.3559
w14 := w14 + η * x1 * δ4 = - 0.2 + 0.3 * 0 * 0.0072 = - 0.2
w24 := w24 + η * x2 * δ4 = 0.2 + 0.3 * 0 * 0.0072 = 0.2
wb4 := wb4 + η * 1 * δ4 = - 0.3 + 0.3 * 1 * 0.0072 = - 0.2978
w13 := w13 + η * x1 * δ3 = 0.3 + 0.3 * 0 * - 0.0145 = 0.3
w23 := w23 + η * x2 * δ3 = - 0.1 + 0.3 * 0 * - 0.0145 = - 0.1
wb3 := wb3 + η * 1 * δ3 = 0.2 + 0.3 * 1 * - 0.0145 = 0.1957
Epoch: 1
Pattern: 2: x1 = 0, x2 = 1, t = 1
• weights:
w13 = 0.3 w23 = - 0.1 wb3 = 0.1957
w14 = - 0.2 w24 = 0.2 wb4 = - 0.2978
w35 = 0.3758 w45 = - 0.2188 wb5 = 0.3559
• Forward prop:
o net3 = w13 * x1 + w23 * x2 + wb3 = …
o o3 = 1/(1 + e^-net3) = …
o net4 = w14 * x1 + w24 * x2 + wb4 = …
o o4 = 1/(1 + e^-net4) = …
o net5 = w35 * o3 + w45 * o4 + wb5 = …
o y = 1/(1+e^-net5) = …
• Calculating error:
o Err_p2 = 0.5 * (t – y)^2 = …
Epoch: 1
Pattern: 2: x1 = 0, x2 = 1, t = 1
Back Prop:
1) Finding delta
δ5 = y*(1 - y)*(t - y) = …
δ3 = o3(1 – o3)* δ5 * w35 = …
δ4 = o4(1 – o4)* δ5 * w45 = …
2) Finding new weights
w35 := w35 + η * o3 * δ5 = …
w45 := w45 + η * o4 * δ5 = …
wb5 := wb5 + η * 1 * δ5 = …
w14 := w14 + η * x1 * δ4 = …
w24 := w24 + η * x2 * δ4 = …
wb4 := wb4 + η * 1 * δ4 = …
w13 := w13 + η * x1 * δ3 = …
w23 := w23 + η * x2 * δ3 = …
wb3 := wb3 + η * 1 * δ3 = …
Epoch: 1
Pattern: 3: x1 = 1, x2 = 0, t = 1
• weights:
w13 = ? w23 = ? wb3 = ?
w14 = ? w24 = ? wb4 = ?
w35 = ? w45 = ? wb5 = ?
• Forward prop:
o net3 = w13 * x1 + w23 * x2 + wb3 = …
o o3 = 1/(1 + e^-net3) = …
o net4 = w14 * x1 + w24 * x2 + wb4 = …
o o4 = 1/(1 + e^-net4) = …
o net5 = w35 * o3 + w45 * o4 + wb5 = …
o y = 1/(1+e^-net5) = …
• Calculating error:
o Err_p3 = 0.5 * (t – y)^2 = …
Epoch: 1
Pattern: 3: x1 = 1, x2 = 0, t = 1
Back Prop:
1) Finding delta
δ5 = y*(1 - y)*(t - y) = …
δ3 = o3(1 – o3)* δ5 * w35 = …
δ4 = o4(1 – o4)* δ5 * w45 = …
2) Finding new weights
w35 := w35 + η * o3 * δ5 = …
w45 := w45 + η * o4 * δ5 = …
wb5 := wb5 + η * 1 * δ5 = …
w14 := w14 + η * x1 * δ4 = …
w24 := w24 + η * x2 * δ4 = …
wb4 := wb4 + η * 1 * δ4 = …
w13 := w13 + η * x1 * δ3 = …
w23 := w23 + η * x2 * δ3 = …
wb3 := wb3 + η * 1 * δ3 = …
Epoch: 1
Pattern: 4: x1 = 1, x2 = 1, t = 0
• weights:
w13 = ? w23 = ? wb3 = ?
w14 = ? w24 = ? wb4 = ?
w35 = ? w45 = ? wb5 = ?
• Forward prop:
o net3 = w13 * x1 + w23 * x2 + wb3 = …
o o3 = 1/(1 + e^-net3) = …
o net4 = w14 * x1 + w24 * x2 + wb4 = …
o o4 = 1/(1 + e^-net4) = …
o net5 = w35 * o3 + w45 * o4 + wb5 = …
o y = 1/(1+e^-net5) = …
• Calculating error:
o Err_p4 = 0.5 * (t – y)^2 = …
Epoch: 1
Pattern: 4: x1 = 1, x2 = 1, t = 0
Back Prop:
1) Finding delta
δ5 = y*(1 - y)*(t - y) = …
δ3 = o3(1 – o3)* δ5 * w35 = …
δ4 = o4(1 – o4)* δ5 * w45 = …
2) Finding new weights
w35 := w35 + η * o3 * δ5 = …
w45 := w45 + η * o4 * δ5 = …
wb5 := wb5 + η * 1 * δ5 = …
w14 := w14 + η * x1 * δ4 = …
w24 := w24 + η * x2 * δ4 = …
wb4 := wb4 + η * 1 * δ4 = …
w13 := w13 + η * x1 * δ3 = …
w23 := w23 + η * x2 * δ3 = …
wb3 := wb3 + η * 1 * δ3 = …
End of Epoch 1
Total error = Err_p1 + Err_p2 + Err_p3 + Err_p4 = 0.1988 + …
If Total error <= tolerance (If given): Then stop training
If epoch number = max number of epochs (if given): Then stop training
Otherwise, run another epoch using last weights

More Related Content

Similar to problems - MLP.pdf

Data mining assignment 5
Data mining assignment 5Data mining assignment 5
Data mining assignment 5BarryK88
 
All Pair shortest Path.pptx
All Pair shortest Path.pptxAll Pair shortest Path.pptx
All Pair shortest Path.pptxSayaliKawale2
 
Operaciones combinadas 5º e
Operaciones combinadas 5º eOperaciones combinadas 5º e
Operaciones combinadas 5º etorreblanca77
 
Square root and quadratic function
Square root and quadratic functionSquare root and quadratic function
Square root and quadratic functionNeil MacIntosh
 
Solutions manual for fundamentals of business math canadian 3rd edition by je...
Solutions manual for fundamentals of business math canadian 3rd edition by je...Solutions manual for fundamentals of business math canadian 3rd edition by je...
Solutions manual for fundamentals of business math canadian 3rd edition by je...Pollockker
 
RS Agarwal Quantitative Aptitude - 9 chap
RS Agarwal Quantitative Aptitude - 9 chapRS Agarwal Quantitative Aptitude - 9 chap
RS Agarwal Quantitative Aptitude - 9 chapVinoth Kumar.K
 
self learning ppt of EM-1 swami group ppt
self learning ppt of EM-1 swami group pptself learning ppt of EM-1 swami group ppt
self learning ppt of EM-1 swami group pptAmolAher20
 
Solution Manual : Chapter - 05 Integration
Solution Manual : Chapter - 05 IntegrationSolution Manual : Chapter - 05 Integration
Solution Manual : Chapter - 05 IntegrationHareem Aslam
 
EM 2 Group - 4 engineering mathematics pptx
EM 2 Group - 4 engineering mathematics pptxEM 2 Group - 4 engineering mathematics pptx
EM 2 Group - 4 engineering mathematics pptxAmolAher20
 
Johnson's algorithm
Johnson's algorithmJohnson's algorithm
Johnson's algorithmKiran K
 
Module 3 quadratic functions
Module 3   quadratic functionsModule 3   quadratic functions
Module 3 quadratic functionsdionesioable
 
Lecture 2: Artificial Neural Network
Lecture 2: Artificial Neural NetworkLecture 2: Artificial Neural Network
Lecture 2: Artificial Neural NetworkMohamed Loey
 
Pt 3&4 turunan fungsi implisit dan cyclometri
Pt 3&4 turunan fungsi implisit dan cyclometriPt 3&4 turunan fungsi implisit dan cyclometri
Pt 3&4 turunan fungsi implisit dan cyclometrilecturer
 

Similar to problems - MLP.pdf (20)

Data mining assignment 5
Data mining assignment 5Data mining assignment 5
Data mining assignment 5
 
9 chap
9 chap9 chap
9 chap
 
All Pair shortest Path.pptx
All Pair shortest Path.pptxAll Pair shortest Path.pptx
All Pair shortest Path.pptx
 
Operaciones combinadas 5º e
Operaciones combinadas 5º eOperaciones combinadas 5º e
Operaciones combinadas 5º e
 
Square root and quadratic function
Square root and quadratic functionSquare root and quadratic function
Square root and quadratic function
 
Solutions manual for fundamentals of business math canadian 3rd edition by je...
Solutions manual for fundamentals of business math canadian 3rd edition by je...Solutions manual for fundamentals of business math canadian 3rd edition by je...
Solutions manual for fundamentals of business math canadian 3rd edition by je...
 
RS Agarwal Quantitative Aptitude - 9 chap
RS Agarwal Quantitative Aptitude - 9 chapRS Agarwal Quantitative Aptitude - 9 chap
RS Agarwal Quantitative Aptitude - 9 chap
 
self learning ppt of EM-1 swami group ppt
self learning ppt of EM-1 swami group pptself learning ppt of EM-1 swami group ppt
self learning ppt of EM-1 swami group ppt
 
Hw5sols
Hw5solsHw5sols
Hw5sols
 
Lec38
Lec38Lec38
Lec38
 
Solution Manual : Chapter - 05 Integration
Solution Manual : Chapter - 05 IntegrationSolution Manual : Chapter - 05 Integration
Solution Manual : Chapter - 05 Integration
 
Diff-Eqs
Diff-EqsDiff-Eqs
Diff-Eqs
 
4. simplifications
4. simplifications4. simplifications
4. simplifications
 
EM 2 Group - 4 engineering mathematics pptx
EM 2 Group - 4 engineering mathematics pptxEM 2 Group - 4 engineering mathematics pptx
EM 2 Group - 4 engineering mathematics pptx
 
9. surds & indices
9. surds & indices9. surds & indices
9. surds & indices
 
Deber10
Deber10Deber10
Deber10
 
Johnson's algorithm
Johnson's algorithmJohnson's algorithm
Johnson's algorithm
 
Module 3 quadratic functions
Module 3   quadratic functionsModule 3   quadratic functions
Module 3 quadratic functions
 
Lecture 2: Artificial Neural Network
Lecture 2: Artificial Neural NetworkLecture 2: Artificial Neural Network
Lecture 2: Artificial Neural Network
 
Pt 3&4 turunan fungsi implisit dan cyclometri
Pt 3&4 turunan fungsi implisit dan cyclometriPt 3&4 turunan fungsi implisit dan cyclometri
Pt 3&4 turunan fungsi implisit dan cyclometri
 

More from ahmedsalim244821

More from ahmedsalim244821 (10)

aco-3a.ppt
aco-3a.pptaco-3a.ppt
aco-3a.ppt
 
stuetzle.pdf
stuetzle.pdfstuetzle.pdf
stuetzle.pdf
 
lecture10_ACO.pdf
lecture10_ACO.pdflecture10_ACO.pdf
lecture10_ACO.pdf
 
Swarm Optimization Techniques_ACO.pdf
Swarm Optimization Techniques_ACO.pdfSwarm Optimization Techniques_ACO.pdf
Swarm Optimization Techniques_ACO.pdf
 
ANT-presentation.ppt
ANT-presentation.pptANT-presentation.ppt
ANT-presentation.ppt
 
Micro-strip Antennas.pdf
Micro-strip Antennas.pdfMicro-strip Antennas.pdf
Micro-strip Antennas.pdf
 
ZERO_ENERGY_BUILDING.ppt
ZERO_ENERGY_BUILDING.pptZERO_ENERGY_BUILDING.ppt
ZERO_ENERGY_BUILDING.ppt
 
Chap16-1-NMOS-Inverter.pdf
Chap16-1-NMOS-Inverter.pdfChap16-1-NMOS-Inverter.pdf
Chap16-1-NMOS-Inverter.pdf
 
lecture08.pdf
lecture08.pdflecture08.pdf
lecture08.pdf
 
lecture-09-evolutionary-computation-genetic-algorithms.pdf
lecture-09-evolutionary-computation-genetic-algorithms.pdflecture-09-evolutionary-computation-genetic-algorithms.pdf
lecture-09-evolutionary-computation-genetic-algorithms.pdf
 

Recently uploaded

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingWSO2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

problems - MLP.pdf

  • 2. Steps of a single epoch For each pattern • Forward prop oCalculate 𝑛𝑒𝑡𝑗 and 𝑜𝑗 for all neurons (except input layer and bias neurons) oCalculate specific error (for single pattern) • Back prop oCalculate 𝛿𝑗 for all neurons (except input layer and bias neurons) oCalculate ∆𝑤𝑖,𝑗 for all variable weights including bias weights o𝑤𝑖,𝑗 ≔ 𝑤𝑖,𝑗 + ∆𝑤𝑖,𝑗
  • 3. After end of epoch • Calculate total error = sum of specific errors • Check stopping condition • Run another epoch if stopping condition is False
  • 4. Notes • 𝑛𝑒𝑡ℎ = 𝑘∈𝐾 𝑤𝑘,ℎ 𝑜𝑘 • 𝑜ℎ = 𝑓𝑎𝑐𝑡 𝑛𝑒𝑡ℎ Default is 1 1+𝑒−𝑛𝑒𝑡 • 𝛿ℎ = • 𝑓𝑎𝑐𝑡 ′ 𝑛𝑒𝑡ℎ ∙ 𝑙∈𝐿 𝛿𝑙 𝑤ℎ,𝑙 if h is hidden neuron • Default is: 𝑜ℎ 1 − 𝑜ℎ 𝑙∈𝐿 𝛿𝑙 𝑤ℎ,𝑙 for sigmoid activation function • 𝑓𝑎𝑐𝑡 ′ 𝑛𝑒𝑡ℎ ∙ − 𝜕𝐸𝑟𝑟𝑝 𝜕𝑦ℎ if h is output neuron • Default is: 𝑦ℎ(1 − 𝑦ℎ)(𝑡ℎ − 𝑦ℎ) for sigmoid activation function and for 𝐸𝑟𝑟𝑝 = 1 2 ℎ∈𝐻 𝑡ℎ − 𝑦ℎ 2 Warning! if different activation function or different error function is used, you must calculate the derivatives 𝑓𝑎𝑐𝑡 ′ 𝑛𝑒𝑡ℎ ∙ − 𝜕𝐸𝑟𝑟𝑝 𝜕𝑦ℎ Assuming layer K is before layer H, and either layer L is after layer H, or layer H is the output layer
  • 5. Notes • ∆𝑤𝑖,𝑗 = 𝜂 𝑜𝑖 𝛿𝑗 • 𝑤𝑖,𝑗 ≔ 𝑤𝑖,𝑗 + 𝜂 𝑜𝑖 𝛿𝑗 • If i is input neuron: 𝑜𝑖 = 𝑥𝑖 • If i is bias neuron: 𝑜𝑖 = 1
  • 6. Example x1 x2 t 0 0 0 0 1 1 1 0 1 1 1 0 Assume learning rate = 0.3
  • 7. Epoch: 1 Pattern: 1: x1 = 0, x2 = 0, t = 0 • Initial weights: w13 = 0.3 w23 = -0.1 wb3 = 0.2 w14 = -0.2 w24 = 0.2 wb4 = -0.3 w35 = 0.4 w45 = -0.2 wb5 = 0.4 • Forward prop: o net3 = w13 * x1 + w23 * x2 + wb3 = 0.3 * 0 – 0.1 * 0 + 0.2 = 0.2 o o3 = 1/(1 + e^-net3) = 1/(1 + e^-0.2) = 0.5498 o net4 = w14 * x1 + w24 * x2 + wb4 = -0.2 * 0 + 0.2 * 0 – 0.3 = -0.3 o o4 = 1/(1 + e^-net4) = 1/(1 + e^0.3) = 0.4256 o net5 = w35 * o3 + w45 * o4 + wb5 = 0.4 * 0.5498 – 0.2 * 0.4256 + 0.4 = 0.5348 o y = 1/(1+e^-net5) = 1/(1+e^-0.5348) = 0.6306 • Calculating error: o Err_p1 = 0.5 * (0 – 0.6306)^2 = 0.1988
  • 8. Epoch: 1 Pattern: 1: x1 = 0, x2 = 0, t = 0 Back Prop: 1) Finding delta δ5 = y*(1 - y)*(t - y) = 0.6306 * (1 - 0.6306) * (0 - 0.6306) = - 0.1469 δ3 = o3(1 – o3)* δ5 * w35 = 0.5498 * (1 - 0.5498) * - 0.1469 * 0.4 = - 0.0145 δ4 = o4(1 – o4)* δ5 * w45 = 0.4256 * (1 - 0.4256) * - 0.1469 * -0.2 = 0.0072 2) Finding new weights w35 := w35 + η * o3 * δ5 = 0.4 + 0.3 * 0.5498 * - 0.1469 = 0.3758 w45 := w45 + η * o4 * δ5 = -0.2 + 0.3 * 0.4256 * - 0.1469 = -0.2188 wb5 := wb5 + η * 1 * δ5 = 0.4 + 0.3 * 1 * - 0.1469 = 0.3559 w14 := w14 + η * x1 * δ4 = - 0.2 + 0.3 * 0 * 0.0072 = - 0.2 w24 := w24 + η * x2 * δ4 = 0.2 + 0.3 * 0 * 0.0072 = 0.2 wb4 := wb4 + η * 1 * δ4 = - 0.3 + 0.3 * 1 * 0.0072 = - 0.2978 w13 := w13 + η * x1 * δ3 = 0.3 + 0.3 * 0 * - 0.0145 = 0.3 w23 := w23 + η * x2 * δ3 = - 0.1 + 0.3 * 0 * - 0.0145 = - 0.1 wb3 := wb3 + η * 1 * δ3 = 0.2 + 0.3 * 1 * - 0.0145 = 0.1957
  • 9. Epoch: 1 Pattern: 2: x1 = 0, x2 = 1, t = 1 • weights: w13 = 0.3 w23 = - 0.1 wb3 = 0.1957 w14 = - 0.2 w24 = 0.2 wb4 = - 0.2978 w35 = 0.3758 w45 = - 0.2188 wb5 = 0.3559 • Forward prop: o net3 = w13 * x1 + w23 * x2 + wb3 = … o o3 = 1/(1 + e^-net3) = … o net4 = w14 * x1 + w24 * x2 + wb4 = … o o4 = 1/(1 + e^-net4) = … o net5 = w35 * o3 + w45 * o4 + wb5 = … o y = 1/(1+e^-net5) = … • Calculating error: o Err_p2 = 0.5 * (t – y)^2 = …
  • 10. Epoch: 1 Pattern: 2: x1 = 0, x2 = 1, t = 1 Back Prop: 1) Finding delta δ5 = y*(1 - y)*(t - y) = … δ3 = o3(1 – o3)* δ5 * w35 = … δ4 = o4(1 – o4)* δ5 * w45 = … 2) Finding new weights w35 := w35 + η * o3 * δ5 = … w45 := w45 + η * o4 * δ5 = … wb5 := wb5 + η * 1 * δ5 = … w14 := w14 + η * x1 * δ4 = … w24 := w24 + η * x2 * δ4 = … wb4 := wb4 + η * 1 * δ4 = … w13 := w13 + η * x1 * δ3 = … w23 := w23 + η * x2 * δ3 = … wb3 := wb3 + η * 1 * δ3 = …
  • 11. Epoch: 1 Pattern: 3: x1 = 1, x2 = 0, t = 1 • weights: w13 = ? w23 = ? wb3 = ? w14 = ? w24 = ? wb4 = ? w35 = ? w45 = ? wb5 = ? • Forward prop: o net3 = w13 * x1 + w23 * x2 + wb3 = … o o3 = 1/(1 + e^-net3) = … o net4 = w14 * x1 + w24 * x2 + wb4 = … o o4 = 1/(1 + e^-net4) = … o net5 = w35 * o3 + w45 * o4 + wb5 = … o y = 1/(1+e^-net5) = … • Calculating error: o Err_p3 = 0.5 * (t – y)^2 = …
  • 12. Epoch: 1 Pattern: 3: x1 = 1, x2 = 0, t = 1 Back Prop: 1) Finding delta δ5 = y*(1 - y)*(t - y) = … δ3 = o3(1 – o3)* δ5 * w35 = … δ4 = o4(1 – o4)* δ5 * w45 = … 2) Finding new weights w35 := w35 + η * o3 * δ5 = … w45 := w45 + η * o4 * δ5 = … wb5 := wb5 + η * 1 * δ5 = … w14 := w14 + η * x1 * δ4 = … w24 := w24 + η * x2 * δ4 = … wb4 := wb4 + η * 1 * δ4 = … w13 := w13 + η * x1 * δ3 = … w23 := w23 + η * x2 * δ3 = … wb3 := wb3 + η * 1 * δ3 = …
  • 13. Epoch: 1 Pattern: 4: x1 = 1, x2 = 1, t = 0 • weights: w13 = ? w23 = ? wb3 = ? w14 = ? w24 = ? wb4 = ? w35 = ? w45 = ? wb5 = ? • Forward prop: o net3 = w13 * x1 + w23 * x2 + wb3 = … o o3 = 1/(1 + e^-net3) = … o net4 = w14 * x1 + w24 * x2 + wb4 = … o o4 = 1/(1 + e^-net4) = … o net5 = w35 * o3 + w45 * o4 + wb5 = … o y = 1/(1+e^-net5) = … • Calculating error: o Err_p4 = 0.5 * (t – y)^2 = …
  • 14. Epoch: 1 Pattern: 4: x1 = 1, x2 = 1, t = 0 Back Prop: 1) Finding delta δ5 = y*(1 - y)*(t - y) = … δ3 = o3(1 – o3)* δ5 * w35 = … δ4 = o4(1 – o4)* δ5 * w45 = … 2) Finding new weights w35 := w35 + η * o3 * δ5 = … w45 := w45 + η * o4 * δ5 = … wb5 := wb5 + η * 1 * δ5 = … w14 := w14 + η * x1 * δ4 = … w24 := w24 + η * x2 * δ4 = … wb4 := wb4 + η * 1 * δ4 = … w13 := w13 + η * x1 * δ3 = … w23 := w23 + η * x2 * δ3 = … wb3 := wb3 + η * 1 * δ3 = …
  • 15. End of Epoch 1 Total error = Err_p1 + Err_p2 + Err_p3 + Err_p4 = 0.1988 + … If Total error <= tolerance (If given): Then stop training If epoch number = max number of epochs (if given): Then stop training Otherwise, run another epoch using last weights