SlideShare a Scribd company logo
Social Forecasting
Lecture4:NeuralNetworks(I)
Thomas Chadefaux
Neural Networks
How we learn
3/31
How we learn
4/31
Neural Networks
5/31
Neural Networks
6/31
Neural Networks
7/31
Neural Networks: visualization
https://playground.tensorflow.org/#activation=tanh&batchSize=10&dataset=circle&
plane&learningRate=0.03&regularizationRate=0&noise=0&networkShape=4,2&see
8/31
A simple example: “logit” neural network
Neuron Activation y
Feature1
weight
Feature2
weight
9/31
A simple example: “logit” neural network
z = wx+b sigma(z) y
x1
w1
x2
w2
10/31
A simple example: logit
z = WX+b sigma(z) y
x1 = 1.66
w1
x2 = 1.56
w2
11/31
A simple example: logit
suppose , and (initial parameter values). The true
value of y is .
z = 0.1*1.66+0.1*1.56+0
= 0.322
logit(z) y
x1 = 1.66
w1
x2 = 1.56
w2
w1 = 0.1 = 0.1
w2 b = 0
1
12/31
A simple example: logit
suppose , and (initial parameter values). The true
value of y is .
z = 0.1*1.66+0.1*1.56+0
= 0.322
1/(1+exp(-3.22)
=0.579
y
x1 = 1.66
w1
x2 = 1.56
w2
= 0.1
w1 = 0.1
w2 b = 0
1
13/31
A simple example: logit
suppose , and (initial parameter values). The true
value of y is .
z = 0.1*1.66 + 0.1*1.56+0
= 0.322
1/(1+exp(-3.22) yhat=0.579
x1 = 1.66
w1
x2 = 1.56
w2
w1 = 0.1 = 0.1
w2 b = 0
1
14/31
A simple example: logit
We predicted 0.58 when the truth was 1. We can calculate the MSE:
Not bad but can we do better?
Adjust the weights! But how? Make them smaller, larger?
MSE = (target − prediction = (1 − 0.58 = 0.176
)
2
)
2
15/31
Reducing the error
Our goal is to minimize the MSE, so to find this point:
16/31
Reducing the error
But right now we are somewhere else, perhaps here:
17/31
Updating the weights
To update the weights, we need to understand how changing them would
affect our MSE. E.g., should I increase or decrease ? So we’d like to know:
and
and
Let’s look at
w1
∂MSE
∂w1
∂MSE
∂w2
∂MSE
∂b
w1
18/31
Updating the weights
To calculate
we can use the chain rule and note that
,
∂MSE
∂w1
= × ×
∂MSE
∂w1
∂MSE
∂σ(z)
∂σ(z)
∂z
∂z
∂w1
19/31
updating the weights
z=WX+b f(z)
ds/dz
yhat
dMSE/ds
x1 = 1.66
dz/dw1
x2 = 1.56
dz/dw2
= × ×
∂MSE
∂w1
∂MSE
∂σ(z)
∂σ(z)
∂z
∂z
∂w1
20/31
Updating the weights
Let’s calculate each in turn
= × ×
∂MSE
∂w1
∂MSE
∂σ(z)
∂σ(z)
∂z
∂z
∂w1
21/31
Updating the weights
First let’s think about how the MSE changes with :
σ(z)
= = −2(y − σ(z))
∂MSE
∂σ(z)
∂(y − σ(z))
2
∂σ(z)
= −2 × (1 − 0.58) = −0.84
22/31
Updating the weights
Let’s continue.
That one is a tad more complicated and we need the quotient rule:
. After a bit of algebra, we find:
=
∂σ(z)
∂z
∂
1
1+e
−z
∂z
( =
u
v
)
′
v − u
u
′
v
′
v2
= σ(z)(1 − σ(z)) = 0.58(1 − 0.58) = 0.24
∂
1
1+e
−z
∂z
23/31
Updating the weights
And finally we need
= = = 1.66
∂z
∂w1
∂( + + b)
w1x1 w2x2
∂w1
x1
24/31
Updating the weights
So finally we are ready:
What does this tell us? It tells us that a one unit increase in reduces the
MSE by 0.33.
= × ×
∂MSE
∂w1
∂MSE
∂σ(z)
∂σ(z)
∂z
∂z
∂w1
= −0.84 × 0.24 × 1.66 = −0.33
w1
25/31
Updating the weights
That means that we are somewhere here:
26/31
Updating the weights
So we should decrease the weight if we want to reduce our MSE. NB: that’s
just gradient descent: to find a minimum, take repeated steps in the opposite
direction of the gradient.
27/31
Updating the weights
So let’s increase . Let’s increase it by
We’ll do the same thing for . We find that
Similarly,
Let’s see what happens to our prediction this time.
w1
= −0.33
∂MSE
∂w1
w2
= −0.314
∂MSE
∂w2
= −0.2
∂MSE
∂b
28/31
Updating the weights
Now we have , and
(initial parameter values)
z = 0.46*1.66 + 0.414*1.56+0.2
= 1.61
1/(1+exp(-1.61) yhat=0.83
x1 = 1.66
w1
x2 = 1.56
w2
w1 = 0.1 + 0.33 = 0.43 = 0.1 + 0.314
w2 b = 0.2
29/31
Updating the weights
Our prediction has improved to 0.83, which is a significant improvement. A
few more repetitions of this algorithm will get us to a prediction that is closer
and closer to the truth.
30/31
What next?
More neurons, more layers
31/31

More Related Content

Similar to lecture4.pdf

Ib maths sl chain rule
Ib maths sl chain ruleIb maths sl chain rule
Ib maths sl chain rule
estelav
 
Cuaderno+de+integrales
Cuaderno+de+integralesCuaderno+de+integrales
Cuaderno+de+integrales
joseluisroyo
 
5.n nmodels i
5.n nmodels i5.n nmodels i
Integration - Mathematics - UoZ
Integration - Mathematics - UoZ Integration - Mathematics - UoZ
Integration - Mathematics - UoZ
Safen D Taha
 
Statistical Method In Economics
Statistical Method In EconomicsStatistical Method In Economics
Statistical Method In Economics
Economics Homework Helper
 
Machine Learning: The Bare Math Behind Libraries
Machine Learning: The Bare Math Behind LibrariesMachine Learning: The Bare Math Behind Libraries
Machine Learning: The Bare Math Behind Libraries
J On The Beach
 
Solved exercises simple integration
Solved exercises simple integrationSolved exercises simple integration
Solved exercises simple integration
Kamel Attar
 
Lecture 2: Artificial Neural Network
Lecture 2: Artificial Neural NetworkLecture 2: Artificial Neural Network
Lecture 2: Artificial Neural Network
Mohamed Loey
 
Manual solucoes ex_extras
Manual solucoes ex_extrasManual solucoes ex_extras
Manual solucoes ex_extras
Vandilberto Pinto
 
Manual solucoes ex_extras
Manual solucoes ex_extrasManual solucoes ex_extras
Manual solucoes ex_extras
Vandilberto Pinto
 
Manual solucoes ex_extras
Manual solucoes ex_extrasManual solucoes ex_extras
Manual solucoes ex_extras
VandilbertoPinto1
 
Artificial Neural Networks
Artificial Neural NetworksArtificial Neural Networks
Artificial Neural Networks
Stefano Dalla Palma
 
Calculus 08 techniques_of_integration
Calculus 08 techniques_of_integrationCalculus 08 techniques_of_integration
Calculus 08 techniques_of_integration
tutulk
 
11365.integral 2
11365.integral 211365.integral 2
11365.integral 2
Nidhu Sharma
 
Max net
Max netMax net
Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3
Fabian Pedregosa
 
Neural Networks
Neural NetworksNeural Networks
LINEAR SYSTEMS
LINEAR SYSTEMSLINEAR SYSTEMS
LINEAR SYSTEMS
JazzieJao1
 
Introduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksIntroduction to Artificial Neural Networks
Introduction to Artificial Neural Networks
Stratio
 
Dm part03 neural-networks-handout
Dm part03 neural-networks-handoutDm part03 neural-networks-handout
Dm part03 neural-networks-handout
okeee
 

Similar to lecture4.pdf (20)

Ib maths sl chain rule
Ib maths sl chain ruleIb maths sl chain rule
Ib maths sl chain rule
 
Cuaderno+de+integrales
Cuaderno+de+integralesCuaderno+de+integrales
Cuaderno+de+integrales
 
5.n nmodels i
5.n nmodels i5.n nmodels i
5.n nmodels i
 
Integration - Mathematics - UoZ
Integration - Mathematics - UoZ Integration - Mathematics - UoZ
Integration - Mathematics - UoZ
 
Statistical Method In Economics
Statistical Method In EconomicsStatistical Method In Economics
Statistical Method In Economics
 
Machine Learning: The Bare Math Behind Libraries
Machine Learning: The Bare Math Behind LibrariesMachine Learning: The Bare Math Behind Libraries
Machine Learning: The Bare Math Behind Libraries
 
Solved exercises simple integration
Solved exercises simple integrationSolved exercises simple integration
Solved exercises simple integration
 
Lecture 2: Artificial Neural Network
Lecture 2: Artificial Neural NetworkLecture 2: Artificial Neural Network
Lecture 2: Artificial Neural Network
 
Manual solucoes ex_extras
Manual solucoes ex_extrasManual solucoes ex_extras
Manual solucoes ex_extras
 
Manual solucoes ex_extras
Manual solucoes ex_extrasManual solucoes ex_extras
Manual solucoes ex_extras
 
Manual solucoes ex_extras
Manual solucoes ex_extrasManual solucoes ex_extras
Manual solucoes ex_extras
 
Artificial Neural Networks
Artificial Neural NetworksArtificial Neural Networks
Artificial Neural Networks
 
Calculus 08 techniques_of_integration
Calculus 08 techniques_of_integrationCalculus 08 techniques_of_integration
Calculus 08 techniques_of_integration
 
11365.integral 2
11365.integral 211365.integral 2
11365.integral 2
 
Max net
Max netMax net
Max net
 
Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3
 
Neural Networks
Neural NetworksNeural Networks
Neural Networks
 
LINEAR SYSTEMS
LINEAR SYSTEMSLINEAR SYSTEMS
LINEAR SYSTEMS
 
Introduction to Artificial Neural Networks
Introduction to Artificial Neural NetworksIntroduction to Artificial Neural Networks
Introduction to Artificial Neural Networks
 
Dm part03 neural-networks-handout
Dm part03 neural-networks-handoutDm part03 neural-networks-handout
Dm part03 neural-networks-handout
 

Recently uploaded

How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 

Recently uploaded (20)

How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 

lecture4.pdf