SlideShare a Scribd company logo
1 of 58
Download to read offline
Neural Nets from
Scratch Pt. 1
Seth Weidman
March 1, 2016
–John Cochrane
“Don’t get hung up on notation. Understanding
the concepts is the important thing here…If you
understand the concepts, you can invent
your own notation.”
Table of contents
• What are neural nets used for?
• What are they, mathematically?
• How, and why, do they work?
What are neural nets used for?
What are neural nets used for?
They’re both examples of supervised
learning, or function approximation.
What are neural nets used for?
What is common about these two
examples?
Table of contents
• What are neural nets used for?
• What are they, mathematically?
• How, and why, do they work?
X1 X2 X3 Y
1 1 1 1
0 1 0 0
0 0 1 1
1 1 0 0
Example problem:
Problem: what is “f”?
Function approximation example:

Logistic regression:
Function approximation example:

Logistic regression:
???
Function approximation example:

neural nets:
Function approximation example:

neural nets:
• Neural nets can be written, mathematically, as nested
functions.
• We’ll translate this:
• Into this:
• This will tell us exactly how to “train” the neural net: that
is, how to update the weights to make better
predictions.
Table of contents
• What are neural nets used for?
• What are they, mathematically?
• How, and why, do they work?
Goal:
• Break down how neural nets make their
predictions. That is, compute:
• Understand how this computation corresponds to a
typical notion of a neural net:
Step “A”:
Goal: compute
Step “A”: code
Step “B”:
Goal: compute
A digression on the sigmoid function, part 1:
Step “C”:
Goal: compute
Final step: Prediction
Goal: compute
How do we know if this prediction was any good?
Answer: we compute the loss:
How can change the weights V

and W by to reduce this loss?
Strategy: compute the derivatives:
Then, subtract those derivatives

from the weights themselves:
Strategy: compute the derivatives:
Since neural nets are nested functions, we’ll compute the
derivatives of each of those functions:
We’ll then be able to compute and by
multiplying these derivatives together. This will work
because of the chain rule.
A digression on the chain rule:
Because of the chain rule, we can compute the derivative of
a nested function by taking the derivatives of each individual
function and multiplying those derivatives together.
Updating the weights, step 1:
Goal: compute and
Strategy: compute the derivatives:
A digression on the sigmoid function, part 2:
Updating the weights, step 2:
Goal: compute and
Strategy: compute the derivatives:
Updating the weights, step 3:
Goal: compute and
Strategy: compute the derivatives:
Updating the weights: updating “W”
Updating the weights, step 4:
Goal: compute and
Strategy: compute the derivatives:
Updating the weights, step 5:
Goal: compute and
Strategy: compute the derivatives:
Updating the weights, step 6:
Goal: compute and
Strategy: compute the derivatives:
{
{
{
3 x 1 1 x 4 1 x 4
{Element-wise

multiplication
{
Matrix

multiplication
Updating the weights: updating “V”
Update the weights!
This works!
Leading online learning platform
explanation of backpropogation
This tells you how backpropogation works,
but not why it works.
Key takeaways:
• Neural nets are, mathematically, nested functions.
• “Backpropogation” is just computing successive
derivatives of these individual functions.
• Backpropogation works because of the chain rule.
Other resources
• Blog posts:
• Matt Mazur: A Step by Step Backpropogation Example:

https://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/
• Andrej Karpathy: Hacker’s Guide to Neural Networks: 

http://karpathy.github.io/neuralnets/
• Andrew Trask: A Neural Network in 11 Lines of Code: 

http://iamtrask.github.io/2015/07/12/basic-python-network/
• sethweidman.com: sign up for the newsletter to get

emailed when new content is posted
• Learn about other kinds of neural net architectures at

future versions of this Meetup
The end
Table of contents
• What are neural nets used for?
• What are they, mathematically?
• How, and why, do they work?
• Connection to “Deep Learning”
• “Layers” send “inputs” forwards and “gradients” backwards.
• Each layer has an “activation function”.
• Layers that are neither input nor output are “hidden” layers.
• Sending the “errors” backwards is called “backpropogation”.
Terminology
The underlying math is exactly the same as before, just
described differently.
To learn more, visit sethweidman.com.

Sign up for the newsletter!
To learn about other neural net architectures, check out
future Chi Town Machine Learning Meetups, featuring
speakers such as Jeremy Watt, Rami Jachi, and Seth
Weidman. Sponsored by Nousot!
Key takeaways:
• Neural nets are, mathematically, nested functions.
• “Backpropogation” is just computing successive
derivatives of these individual functions.
• Backpropogation works because of the chain rule.
The end
x_1
w_1
x_2
w_2
h = x_1 * w_1 +

x_2 * w_2
a = sigmoid(h)
H = a * W
error =
y - y_hat
delta_H_out =
(y - y_hat) *

sigmoid’(H)
W_update =
delta_H_out *

a
scaled_error_out =

delta_H_out * W
delta_h_out =
scaled_error_out *

sigmoid’(h)
w_update =
delta_h_out *

x
y_hat = 

sigmoid(H)

More Related Content

What's hot

Neural network image recognition
Neural network image recognitionNeural network image recognition
Neural network image recognitionOleksii Sekundant
 
International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)irjes
 
An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)Thomas da Silva Paula
 
Meta learning with memory augmented neural network
Meta learning with memory augmented neural networkMeta learning with memory augmented neural network
Meta learning with memory augmented neural networkKaty Lee
 

What's hot (6)

Concurrency in c#
Concurrency in c#Concurrency in c#
Concurrency in c#
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Neural network image recognition
Neural network image recognitionNeural network image recognition
Neural network image recognition
 
International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)International Refereed Journal of Engineering and Science (IRJES)
International Refereed Journal of Engineering and Science (IRJES)
 
An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)
 
Meta learning with memory augmented neural network
Meta learning with memory augmented neural networkMeta learning with memory augmented neural network
Meta learning with memory augmented neural network
 

Viewers also liked

Neural nets: How regular expressions brought about deep learning
Neural nets: How regular expressions brought about deep learningNeural nets: How regular expressions brought about deep learning
Neural nets: How regular expressions brought about deep learningMatthew
 
P03 neural networks cvpr2012 deep learning methods for vision
P03 neural networks cvpr2012 deep learning methods for visionP03 neural networks cvpr2012 deep learning methods for vision
P03 neural networks cvpr2012 deep learning methods for visionzukun
 
Perceptron (neural network)
Perceptron (neural network)Perceptron (neural network)
Perceptron (neural network)EdutechLearners
 
Artificial Neural Networks Lect5: Multi-Layer Perceptron & Backpropagation
Artificial Neural Networks Lect5: Multi-Layer Perceptron & BackpropagationArtificial Neural Networks Lect5: Multi-Layer Perceptron & Backpropagation
Artificial Neural Networks Lect5: Multi-Layer Perceptron & BackpropagationMohammed Bennamoun
 
Neural Networks and Deep Learning (Part 1 of 2): An introduction - Valentino ...
Neural Networks and Deep Learning (Part 1 of 2): An introduction - Valentino ...Neural Networks and Deep Learning (Part 1 of 2): An introduction - Valentino ...
Neural Networks and Deep Learning (Part 1 of 2): An introduction - Valentino ...Data Science Milan
 
Python for Image Understanding: Deep Learning with Convolutional Neural Nets
Python for Image Understanding: Deep Learning with Convolutional Neural NetsPython for Image Understanding: Deep Learning with Convolutional Neural Nets
Python for Image Understanding: Deep Learning with Convolutional Neural NetsRoelof Pieters
 

Viewers also liked (8)

Neural nets: How regular expressions brought about deep learning
Neural nets: How regular expressions brought about deep learningNeural nets: How regular expressions brought about deep learning
Neural nets: How regular expressions brought about deep learning
 
MLP Guide for Proposers & Instructors
MLP Guide for Proposers & InstructorsMLP Guide for Proposers & Instructors
MLP Guide for Proposers & Instructors
 
P03 neural networks cvpr2012 deep learning methods for vision
P03 neural networks cvpr2012 deep learning methods for visionP03 neural networks cvpr2012 deep learning methods for vision
P03 neural networks cvpr2012 deep learning methods for vision
 
Neural networks
Neural networksNeural networks
Neural networks
 
Perceptron (neural network)
Perceptron (neural network)Perceptron (neural network)
Perceptron (neural network)
 
Artificial Neural Networks Lect5: Multi-Layer Perceptron & Backpropagation
Artificial Neural Networks Lect5: Multi-Layer Perceptron & BackpropagationArtificial Neural Networks Lect5: Multi-Layer Perceptron & Backpropagation
Artificial Neural Networks Lect5: Multi-Layer Perceptron & Backpropagation
 
Neural Networks and Deep Learning (Part 1 of 2): An introduction - Valentino ...
Neural Networks and Deep Learning (Part 1 of 2): An introduction - Valentino ...Neural Networks and Deep Learning (Part 1 of 2): An introduction - Valentino ...
Neural Networks and Deep Learning (Part 1 of 2): An introduction - Valentino ...
 
Python for Image Understanding: Deep Learning with Convolutional Neural Nets
Python for Image Understanding: Deep Learning with Convolutional Neural NetsPython for Image Understanding: Deep Learning with Convolutional Neural Nets
Python for Image Understanding: Deep Learning with Convolutional Neural Nets
 

Similar to Neural Nets from Scratch

Deep learning from scratch
Deep learning from scratch Deep learning from scratch
Deep learning from scratch Eran Shlomo
 
EssentialsOfMachineLearning.pdf
EssentialsOfMachineLearning.pdfEssentialsOfMachineLearning.pdf
EssentialsOfMachineLearning.pdfAnkita Tiwari
 
Introduction to Deep learning and H2O for beginner's
Introduction to Deep learning and H2O for beginner'sIntroduction to Deep learning and H2O for beginner's
Introduction to Deep learning and H2O for beginner'sVidyasagar Bhargava
 
Training Neural Networks
Training Neural NetworksTraining Neural Networks
Training Neural NetworksDatabricks
 
Deep learning crash course
Deep learning crash courseDeep learning crash course
Deep learning crash courseVishwas N
 
ML Module 3 Non Linear Learning.pptx
ML Module 3 Non Linear Learning.pptxML Module 3 Non Linear Learning.pptx
ML Module 3 Non Linear Learning.pptxDebabrataPain1
 
Machine Learning, Deep Learning and Data Analysis Introduction
Machine Learning, Deep Learning and Data Analysis IntroductionMachine Learning, Deep Learning and Data Analysis Introduction
Machine Learning, Deep Learning and Data Analysis IntroductionTe-Yen Liu
 
Hacking Predictive Modeling - RoadSec 2018
Hacking Predictive Modeling - RoadSec 2018Hacking Predictive Modeling - RoadSec 2018
Hacking Predictive Modeling - RoadSec 2018HJ van Veen
 
Understanding Deep Learning & Parameter Tuning with MXnet, H2o Package in R
Understanding Deep Learning & Parameter Tuning with MXnet, H2o Package in RUnderstanding Deep Learning & Parameter Tuning with MXnet, H2o Package in R
Understanding Deep Learning & Parameter Tuning with MXnet, H2o Package in RManish Saraswat
 
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...Simplilearn
 
Separating Hype from Reality in Deep Learning with Sameer Farooqui
 Separating Hype from Reality in Deep Learning with Sameer Farooqui Separating Hype from Reality in Deep Learning with Sameer Farooqui
Separating Hype from Reality in Deep Learning with Sameer FarooquiDatabricks
 
Introduction to Neural networks (under graduate course) Lecture 9 of 9
Introduction to Neural networks (under graduate course) Lecture 9 of 9Introduction to Neural networks (under graduate course) Lecture 9 of 9
Introduction to Neural networks (under graduate course) Lecture 9 of 9Randa Elanwar
 
Deep learning with Keras
Deep learning with KerasDeep learning with Keras
Deep learning with KerasQuantUniversity
 
How to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make PredictionsHow to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make PredictionsDeveloper Helps
 
Deep Learning Sample Class (Jon Lederman)
Deep Learning Sample Class (Jon Lederman)Deep Learning Sample Class (Jon Lederman)
Deep Learning Sample Class (Jon Lederman)Jon Lederman
 
Activation functions and Training Algorithms for Deep Neural network
Activation functions and Training Algorithms for Deep Neural networkActivation functions and Training Algorithms for Deep Neural network
Activation functions and Training Algorithms for Deep Neural networkGayatri Khanvilkar
 
08 neural networks
08 neural networks08 neural networks
08 neural networksankit_ppt
 

Similar to Neural Nets from Scratch (20)

Deep learning from scratch
Deep learning from scratch Deep learning from scratch
Deep learning from scratch
 
EssentialsOfMachineLearning.pdf
EssentialsOfMachineLearning.pdfEssentialsOfMachineLearning.pdf
EssentialsOfMachineLearning.pdf
 
Introduction to Deep learning and H2O for beginner's
Introduction to Deep learning and H2O for beginner'sIntroduction to Deep learning and H2O for beginner's
Introduction to Deep learning and H2O for beginner's
 
Training Neural Networks
Training Neural NetworksTraining Neural Networks
Training Neural Networks
 
Deep learning crash course
Deep learning crash courseDeep learning crash course
Deep learning crash course
 
ML Module 3 Non Linear Learning.pptx
ML Module 3 Non Linear Learning.pptxML Module 3 Non Linear Learning.pptx
ML Module 3 Non Linear Learning.pptx
 
Machine Learning, Deep Learning and Data Analysis Introduction
Machine Learning, Deep Learning and Data Analysis IntroductionMachine Learning, Deep Learning and Data Analysis Introduction
Machine Learning, Deep Learning and Data Analysis Introduction
 
Hacking Predictive Modeling - RoadSec 2018
Hacking Predictive Modeling - RoadSec 2018Hacking Predictive Modeling - RoadSec 2018
Hacking Predictive Modeling - RoadSec 2018
 
Understanding Deep Learning & Parameter Tuning with MXnet, H2o Package in R
Understanding Deep Learning & Parameter Tuning with MXnet, H2o Package in RUnderstanding Deep Learning & Parameter Tuning with MXnet, H2o Package in R
Understanding Deep Learning & Parameter Tuning with MXnet, H2o Package in R
 
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
Deep Learning Interview Questions And Answers | AI & Deep Learning Interview ...
 
Separating Hype from Reality in Deep Learning with Sameer Farooqui
 Separating Hype from Reality in Deep Learning with Sameer Farooqui Separating Hype from Reality in Deep Learning with Sameer Farooqui
Separating Hype from Reality in Deep Learning with Sameer Farooqui
 
CSSC ML Workshop
CSSC ML WorkshopCSSC ML Workshop
CSSC ML Workshop
 
Introduction to Neural networks (under graduate course) Lecture 9 of 9
Introduction to Neural networks (under graduate course) Lecture 9 of 9Introduction to Neural networks (under graduate course) Lecture 9 of 9
Introduction to Neural networks (under graduate course) Lecture 9 of 9
 
Introduction to deep learning
Introduction to deep learningIntroduction to deep learning
Introduction to deep learning
 
Deep learning with Keras
Deep learning with KerasDeep learning with Keras
Deep learning with Keras
 
NPTEL_SEM_3.pdf
NPTEL_SEM_3.pdfNPTEL_SEM_3.pdf
NPTEL_SEM_3.pdf
 
How to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make PredictionsHow to Build a Neural Network and Make Predictions
How to Build a Neural Network and Make Predictions
 
Deep Learning Sample Class (Jon Lederman)
Deep Learning Sample Class (Jon Lederman)Deep Learning Sample Class (Jon Lederman)
Deep Learning Sample Class (Jon Lederman)
 
Activation functions and Training Algorithms for Deep Neural network
Activation functions and Training Algorithms for Deep Neural networkActivation functions and Training Algorithms for Deep Neural network
Activation functions and Training Algorithms for Deep Neural network
 
08 neural networks
08 neural networks08 neural networks
08 neural networks
 

Recently uploaded

Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...shivangimorya083
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 

Recently uploaded (20)

Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 

Neural Nets from Scratch

  • 1. Neural Nets from Scratch Pt. 1 Seth Weidman March 1, 2016
  • 2. –John Cochrane “Don’t get hung up on notation. Understanding the concepts is the important thing here…If you understand the concepts, you can invent your own notation.”
  • 3. Table of contents • What are neural nets used for? • What are they, mathematically? • How, and why, do they work?
  • 4. What are neural nets used for?
  • 5. What are neural nets used for?
  • 6. They’re both examples of supervised learning, or function approximation. What are neural nets used for? What is common about these two examples?
  • 7. Table of contents • What are neural nets used for? • What are they, mathematically? • How, and why, do they work?
  • 8. X1 X2 X3 Y 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 Example problem: Problem: what is “f”?
  • 12. Function approximation example:
 neural nets: • Neural nets can be written, mathematically, as nested functions. • We’ll translate this: • Into this: • This will tell us exactly how to “train” the neural net: that is, how to update the weights to make better predictions.
  • 13. Table of contents • What are neural nets used for? • What are they, mathematically? • How, and why, do they work?
  • 14. Goal: • Break down how neural nets make their predictions. That is, compute: • Understand how this computation corresponds to a typical notion of a neural net:
  • 17.
  • 19. A digression on the sigmoid function, part 1:
  • 20.
  • 22.
  • 24.
  • 25. How do we know if this prediction was any good? Answer: we compute the loss:
  • 26. How can change the weights V
 and W by to reduce this loss? Strategy: compute the derivatives: Then, subtract those derivatives
 from the weights themselves:
  • 27. Strategy: compute the derivatives: Since neural nets are nested functions, we’ll compute the derivatives of each of those functions: We’ll then be able to compute and by multiplying these derivatives together. This will work because of the chain rule.
  • 28. A digression on the chain rule: Because of the chain rule, we can compute the derivative of a nested function by taking the derivatives of each individual function and multiplying those derivatives together.
  • 29. Updating the weights, step 1: Goal: compute and Strategy: compute the derivatives:
  • 30.
  • 31. A digression on the sigmoid function, part 2:
  • 32. Updating the weights, step 2: Goal: compute and Strategy: compute the derivatives:
  • 33.
  • 34. Updating the weights, step 3: Goal: compute and Strategy: compute the derivatives:
  • 35.
  • 36. Updating the weights: updating “W”
  • 37. Updating the weights, step 4: Goal: compute and Strategy: compute the derivatives:
  • 38.
  • 39. Updating the weights, step 5: Goal: compute and Strategy: compute the derivatives:
  • 40.
  • 41. Updating the weights, step 6: Goal: compute and Strategy: compute the derivatives:
  • 42.
  • 43. { { { 3 x 1 1 x 4 1 x 4 {Element-wise
 multiplication { Matrix
 multiplication Updating the weights: updating “V”
  • 45.
  • 47. Leading online learning platform explanation of backpropogation This tells you how backpropogation works, but not why it works.
  • 48. Key takeaways: • Neural nets are, mathematically, nested functions. • “Backpropogation” is just computing successive derivatives of these individual functions. • Backpropogation works because of the chain rule.
  • 49. Other resources • Blog posts: • Matt Mazur: A Step by Step Backpropogation Example:
 https://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/ • Andrej Karpathy: Hacker’s Guide to Neural Networks: 
 http://karpathy.github.io/neuralnets/ • Andrew Trask: A Neural Network in 11 Lines of Code: 
 http://iamtrask.github.io/2015/07/12/basic-python-network/ • sethweidman.com: sign up for the newsletter to get
 emailed when new content is posted • Learn about other kinds of neural net architectures at
 future versions of this Meetup
  • 51. Table of contents • What are neural nets used for? • What are they, mathematically? • How, and why, do they work? • Connection to “Deep Learning”
  • 52. • “Layers” send “inputs” forwards and “gradients” backwards. • Each layer has an “activation function”. • Layers that are neither input nor output are “hidden” layers. • Sending the “errors” backwards is called “backpropogation”. Terminology
  • 53. The underlying math is exactly the same as before, just described differently.
  • 54. To learn more, visit sethweidman.com.
 Sign up for the newsletter!
  • 55. To learn about other neural net architectures, check out future Chi Town Machine Learning Meetups, featuring speakers such as Jeremy Watt, Rami Jachi, and Seth Weidman. Sponsored by Nousot!
  • 56. Key takeaways: • Neural nets are, mathematically, nested functions. • “Backpropogation” is just computing successive derivatives of these individual functions. • Backpropogation works because of the chain rule.
  • 58. x_1 w_1 x_2 w_2 h = x_1 * w_1 +
 x_2 * w_2 a = sigmoid(h) H = a * W error = y - y_hat delta_H_out = (y - y_hat) *
 sigmoid’(H) W_update = delta_H_out *
 a scaled_error_out =
 delta_H_out * W delta_h_out = scaled_error_out *
 sigmoid’(h) w_update = delta_h_out *
 x y_hat = 
 sigmoid(H)