Neural Networks: Prediction (i.e. the forward pass) Machine Learning Based on slides and material from Geoffrey Hinton, Richard Socher, Dan Roth, 1 Yoav Goldberg, Shai Shalev-Shwartz and Shai Ben-David, and others
Neural Networks • What is a neural network? • Predicting with a neural network • Training neural networks • Practical concerns 2
This lecture • What is a neural network? • Predicting with a neural network • Training neural networks • Practical concerns 3
Let us consider an example network output We will use this example network as to introduce the general principle of how to make predictions with a neural network. 4
Let us consider an example network output Naming conventions for this example Inputs: x • Hidden: z • 𝑧 Output: y • 1 𝑨 ! 𝑨 " 1 𝑦 ! 𝑦 " 5
Let us consider an example network output Naming conventions for this example Inputs: x • Hidden: z • 𝑧 Output: y • 1 𝑨 ! 𝑨 " Bias feature, always 1 1 𝑦 ! 𝑦 " 6
Let us consider an example network output Naming conventions for this example Inputs: x • Hidden: z • 𝑧 Output: y • Sigmoid activations 1 𝑨 ! 𝑨 " Bias feature, always 1 1 𝑦 ! 𝑦 " 7
Let us consider an example network output Naming conventions for this example Inputs: x • Linear activation Hidden: z • 𝑧 Output: y • Sigmoid activations 1 𝑨 ! 𝑨 " Bias feature, always 1 1 𝑦 ! 𝑦 " 8
Let us consider an example network output Naming Convention for Weights -.)/0- - 1.20) 𝑧 𝑥 ()*+,-* #$% 𝑥 "! #$% 𝑥 &! #$% 𝑥 !! 1 𝑨 ! 𝑨 " ' 𝑥 &! ' 𝑥 "" 1 𝑦 ! 𝑦 " 9
Let us consider an example network output Naming Convention for Weights -.)/0- - 1.20) 𝑧 𝑥 ()*+,-* #$% 𝑥 "! #$% 𝑥 &! #$% 𝑥 !! #$% 𝑥 &! 1 𝑨 ! 𝑨 " From neuron #0 ' 𝑥 &! to neuron #1 in ' 𝑥 "" output layer 1 𝑦 ! 𝑦 " 10
How to predict: The forward pass Given an input x , how is the output predicted output 𝑧 #$% 𝑥 "! #$% 𝑥 &! #$% 𝑥 !! 1 𝑨 ! 𝑨 " ' 𝑥 &! ' 𝑥 "" 1 𝑦 ! 𝑦 " 11
The forward pass Given an input x , how is the output predicted output 𝑧 #$% 𝑥 "! #$% 𝑥 &! # + 𝑥 !! # 𝑦 ! + 𝑥 $! # 𝑦 $ ) #$% 𝑥 !! z ! = 𝜏(𝑥 "! 1 𝑨 ! 𝑨 " ' 𝑥 &! ' 𝑥 "" 1 𝑦 ! 𝑦 " 12
The forward pass Given an input x , how is the output predicted output 𝑧 # + 𝑥 !$ # 𝑦 ! + 𝑥 $$ # 𝑦 $ ) 𝑨 $ = 𝜏(𝑥 "$ #$% 𝑥 "! #$% 𝑥 &! # + 𝑥 !! # 𝑦 ! + 𝑥 $! # 𝑦 $ ) #$% 𝑥 !! z ! = 𝜏(𝑥 "! 1 𝑨 ! 𝑨 " ' 𝑥 &! ' 𝑥 "" 1 𝑦 ! 𝑦 " 13
The forward pass Given an input x , how is the output predicted output % + 𝑥 !! % 𝑨 ! + 𝑥 $! % 𝑨 $ output y = 𝑥 "! 𝑧 # + 𝑥 !$ # 𝑦 ! + 𝑥 $$ # 𝑦 $ ) 𝑨 $ = 𝜏(𝑥 "$ #$% 𝑥 "! #$% 𝑥 &! # + 𝑥 !! # 𝑦 ! + 𝑥 $! # 𝑦 $ ) #$% 𝑥 !! z ! = 𝜏(𝑥 "! 1 𝑨 ! 𝑨 " ' 𝑥 &! ' 𝑥 "" 1 𝑦 ! 𝑦 " 14
The forward pass Given an input x , how is the output predicted output % + 𝑥 !! % 𝑨 ! + 𝑥 $! % 𝑨 $ output y = 𝑥 "! 𝑧 # + 𝑥 !$ # 𝑦 ! + 𝑥 $$ # 𝑦 $ ) 𝑨 $ = 𝜏(𝑥 "$ #$% 𝑥 &! # + 𝑥 !! # 𝑦 ! + 𝑥 $! # 𝑦 $ ) #$% 𝑥 !! z ! = 𝜏(𝑥 "! 1 𝑨 ! 𝑨 " ' 𝑥 &! ' 𝑥 "" 1 𝑦 ! 𝑦 " 15
The forward pass output Given an input x , how is the output predicted % + 𝑥 !! % 𝑨 ! + 𝑥 $! % 𝑨 $ output y = 𝑥 "! 𝑧 # + 𝑥 !$ # 𝑦 ! + 𝑥 $$ # 𝑦 $ ) 𝑨 $ = 𝜏(𝑥 "$ #$% 𝑥 "! #$% 𝑥 &! # + 𝑥 !! # 𝑦 ! + 𝑥 $! # 𝑦 $ ) #$% 𝑥 !! z ! = 𝜏(𝑥 "! 1 𝑨 ! 𝑨 " In general, before visiting (i.e. computing) the value of a node, visit all nodes that serve as ' 𝑥 &! inputs to it. ' 𝑥 "" 1 𝑦 ! 𝑦 " 16
The forward pass output Given an input x , how is the output predicted % + 𝑥 !! % 𝑨 ! + 𝑥 $! % 𝑨 $ output y = 𝑥 "! 𝑧 # + 𝑥 !$ # 𝑦 ! + 𝑥 $$ # 𝑦 $ ) 𝑨 $ = 𝜏(𝑥 "$ #$% 𝑥 "! #$% 𝑥 &! # + 𝑥 !! # 𝑦 ! + 𝑥 $! # 𝑦 $ ) #$% 𝑥 !! z ! = 𝜏(𝑥 "! 1 𝑨 ! 𝑨 " In general, before visiting (i.e. computing) the value of a node, visit all nodes that serve as inputs to it. ' 𝑥 &! ' 𝑥 "" Questions? 1 𝑦 ! 𝑦 " 17
Recommend
More recommend