diff --git a/doc/pub/week40/html/._week40-bs000.html b/doc/pub/week40/html/._week40-bs000.html index e8a92879b..79fcc3f5f 100644 --- a/doc/pub/week40/html/._week40-bs000.html +++ b/doc/pub/week40/html/._week40-bs000.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -354,7 +359,7 @@ MathJax.Hub.Config({
  • 9
  • 10
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs001.html b/doc/pub/week40/html/._week40-bs001.html index 3be3357ca..11be6d1f6 100644 --- a/doc/pub/week40/html/._week40-bs001.html +++ b/doc/pub/week40/html/._week40-bs001.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -344,7 +349,7 @@ For neural networks we recommend Goodfellow et al chapters 6 and 7 and Bishop 5.
  • 10
  • 11
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs002.html b/doc/pub/week40/html/._week40-bs002.html index 3af9ae36d..f59bf09ce 100644 --- a/doc/pub/week40/html/._week40-bs002.html +++ b/doc/pub/week40/html/._week40-bs002.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -332,7 +337,7 @@ MathJax.Hub.Config({
  • 11
  • 12
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs003.html b/doc/pub/week40/html/._week40-bs003.html index 59c0e10d5..c272067e1 100644 --- a/doc/pub/week40/html/._week40-bs003.html +++ b/doc/pub/week40/html/._week40-bs003.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -344,7 +349,7 @@ perform a parameter update.
  • 12
  • 13
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs004.html b/doc/pub/week40/html/._week40-bs004.html index 6552bcfdb..f7e37029a 100644 --- a/doc/pub/week40/html/._week40-bs004.html +++ b/doc/pub/week40/html/._week40-bs004.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -356,7 +361,7 @@ sized in powers of 2.
  • 13
  • 14
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs005.html b/doc/pub/week40/html/._week40-bs005.html index e4f921c76..4ce38970b 100644 --- a/doc/pub/week40/html/._week40-bs005.html +++ b/doc/pub/week40/html/._week40-bs005.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -347,7 +352,7 @@ $$
  • 14
  • 15
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs006.html b/doc/pub/week40/html/._week40-bs006.html index 353bc36e1..9a103c987 100644 --- a/doc/pub/week40/html/._week40-bs006.html +++ b/doc/pub/week40/html/._week40-bs006.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -349,7 +354,7 @@ minibatches. We denote these minibatches by \( B_k \) where
  • 15
  • 16
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs007.html b/doc/pub/week40/html/._week40-bs007.html index 48b037135..efaacff02 100644 --- a/doc/pub/week40/html/._week40-bs007.html +++ b/doc/pub/week40/html/._week40-bs007.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -357,7 +362,7 @@ $$
  • 16
  • 17
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs008.html b/doc/pub/week40/html/._week40-bs008.html index 9081fc86a..d1c1dc8f9 100644 --- a/doc/pub/week40/html/._week40-bs008.html +++ b/doc/pub/week40/html/._week40-bs008.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -349,7 +354,7 @@ the number of minibatches, as exemplified in the code below.
  • 17
  • 18
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs009.html b/doc/pub/week40/html/._week40-bs009.html index 1ccd944c4..d1b2fa34b 100644 --- a/doc/pub/week40/html/._week40-bs009.html +++ b/doc/pub/week40/html/._week40-bs009.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -382,7 +387,7 @@ all \( n \) datapoints.
  • 18
  • 19
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs010.html b/doc/pub/week40/html/._week40-bs010.html index 646de7a19..57cd1ee8d 100644 --- a/doc/pub/week40/html/._week40-bs010.html +++ b/doc/pub/week40/html/._week40-bs010.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -350,7 +355,7 @@ gave the lowest value.
  • 19
  • 20
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs011.html b/doc/pub/week40/html/._week40-bs011.html index 3af20006e..68eb4a975 100644 --- a/doc/pub/week40/html/._week40-bs011.html +++ b/doc/pub/week40/html/._week40-bs011.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -400,7 +405,7 @@ j = 0
  • 20
  • 21
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs012.html b/doc/pub/week40/html/._week40-bs012.html index dd26d387d..8d3b9b57b 100644 --- a/doc/pub/week40/html/._week40-bs012.html +++ b/doc/pub/week40/html/._week40-bs012.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -430,7 +435,7 @@ plt.show()
  • 21
  • 22
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs013.html b/doc/pub/week40/html/._week40-bs013.html index 6f6326491..32fc312b5 100644 --- a/doc/pub/week40/html/._week40-bs013.html +++ b/doc/pub/week40/html/._week40-bs013.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -370,7 +375,7 @@ $$
  • 22
  • 23
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs014.html b/doc/pub/week40/html/._week40-bs014.html index c6de5760b..019aefc34 100644 --- a/doc/pub/week40/html/._week40-bs014.html +++ b/doc/pub/week40/html/._week40-bs014.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -362,7 +367,7 @@ $$
  • 23
  • 24
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs015.html b/doc/pub/week40/html/._week40-bs015.html index d04c0b39b..ee164c68b 100644 --- a/doc/pub/week40/html/._week40-bs015.html +++ b/doc/pub/week40/html/._week40-bs015.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -388,7 +393,7 @@ $$
  • 24
  • 25
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs016.html b/doc/pub/week40/html/._week40-bs016.html index aafdacd27..48a3c5b3d 100644 --- a/doc/pub/week40/html/._week40-bs016.html +++ b/doc/pub/week40/html/._week40-bs016.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -361,7 +366,7 @@ ADAM.
  • 25
  • 26
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs017.html b/doc/pub/week40/html/._week40-bs017.html index 68fa0dd24..f1d908fc6 100644 --- a/doc/pub/week40/html/._week40-bs017.html +++ b/doc/pub/week40/html/._week40-bs017.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -364,7 +369,7 @@ learning rate for flat directions.
  • 26
  • 27
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs018.html b/doc/pub/week40/html/._week40-bs018.html index e0c525287..013a1b0c0 100644 --- a/doc/pub/week40/html/._week40-bs018.html +++ b/doc/pub/week40/html/._week40-bs018.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -383,7 +388,7 @@ $$
  • 27
  • 28
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs019.html b/doc/pub/week40/html/._week40-bs019.html index 1c78608b0..dece297a4 100644 --- a/doc/pub/week40/html/._week40-bs019.html +++ b/doc/pub/week40/html/._week40-bs019.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -346,7 +351,7 @@ MathJax.Hub.Config({
  • 28
  • 29
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs020.html b/doc/pub/week40/html/._week40-bs020.html index bfb3f3cc6..718894179 100644 --- a/doc/pub/week40/html/._week40-bs020.html +++ b/doc/pub/week40/html/._week40-bs020.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -436,7 +441,7 @@ plt.show()
  • 29
  • 30
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs021.html b/doc/pub/week40/html/._week40-bs021.html index 6e5af51a1..8ff302775 100644 --- a/doc/pub/week40/html/._week40-bs021.html +++ b/doc/pub/week40/html/._week40-bs021.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -385,7 +390,7 @@ grad_analytical = 30
  • 31
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs022.html b/doc/pub/week40/html/._week40-bs022.html index bf9d93f54..59a66e1fc 100644 --- a/doc/pub/week40/html/._week40-bs022.html +++ b/doc/pub/week40/html/._week40-bs022.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -400,7 +405,7 @@ f2_grad_x2_analytical = x1 31
  • 32
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs023.html b/doc/pub/week40/html/._week40-bs023.html index 9f7e24bff..e86fc7083 100644 --- a/doc/pub/week40/html/._week40-bs023.html +++ b/doc/pub/week40/html/._week40-bs023.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -385,7 +390,7 @@ could expect form a gradient-evaluting function.
  • 32
  • 33
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs024.html b/doc/pub/week40/html/._week40-bs024.html index 18bad6cc2..f24a791f2 100644 --- a/doc/pub/week40/html/._week40-bs024.html +++ b/doc/pub/week40/html/._week40-bs024.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -378,7 +383,7 @@ f4_grad_analytical = x33
  • 34
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs025.html b/doc/pub/week40/html/._week40-bs025.html index cc32043ef..96e869022 100644 --- a/doc/pub/week40/html/._week40-bs025.html +++ b/doc/pub/week40/html/._week40-bs025.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -375,7 +380,7 @@ x = 2.7
  • 34
  • 35
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs026.html b/doc/pub/week40/html/._week40-bs026.html index 41eafe131..a80a339b7 100644 --- a/doc/pub/week40/html/._week40-bs026.html +++ b/doc/pub/week40/html/._week40-bs026.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -416,7 +421,7 @@ f6_grad_analytical = 35
  • 36
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs027.html b/doc/pub/week40/html/._week40-bs027.html index ea3c79c7b..e108a2623 100644 --- a/doc/pub/week40/html/._week40-bs027.html +++ b/doc/pub/week40/html/._week40-bs027.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -388,7 +393,7 @@ f7_grad_analytical = 36
  • 37
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs028.html b/doc/pub/week40/html/._week40-bs028.html index 70cf1f7b5..70c43436c 100644 --- a/doc/pub/week40/html/._week40-bs028.html +++ b/doc/pub/week40/html/._week40-bs028.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -375,7 +380,7 @@ x = 8.4
  • 37
  • 38
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs029.html b/doc/pub/week40/html/._week40-bs029.html index 25c91c23c..f9f132b45 100644 --- a/doc/pub/week40/html/._week40-bs029.html +++ b/doc/pub/week40/html/._week40-bs029.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -412,7 +417,7 @@ x = np.a
  • 38
  • 39
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs030.html b/doc/pub/week40/html/._week40-bs030.html index 7ec5a608e..9ecb2ad30 100644 --- a/doc/pub/week40/html/._week40-bs030.html +++ b/doc/pub/week40/html/._week40-bs030.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -365,7 +370,7 @@ a /=b
  • 39
  • 40
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs031.html b/doc/pub/week40/html/._week40-bs031.html index ceb54747f..2d449ddc7 100644 --- a/doc/pub/week40/html/._week40-bs031.html +++ b/doc/pub/week40/html/._week40-bs031.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -415,7 +420,7 @@ plt.show()
  • 40
  • 41
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs032.html b/doc/pub/week40/html/._week40-bs032.html index c0e9691d5..0f332f3cb 100644 --- a/doc/pub/week40/html/._week40-bs032.html +++ b/doc/pub/week40/html/._week40-bs032.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,7 +316,8 @@ MathJax.Hub.Config({

     

     

     

    -

    And Logistic Regression

    +

    Including Stochastic Gradient Descent with Autograd

    +

    In this code we include the stochastic gradient descent approach discussed above. Note here that we specify which argument we are taking the derivative with respect to when using autograd.

    @@ -320,39 +326,79 @@ MathJax.Hub.Config({
    -
    import autograd.numpy as np
    +  
    # Using Autograd to calculate gradients using SGD
    +# OLS example
    +from random import random, seed
    +import numpy as np
    +import autograd.numpy as np
    +import matplotlib.pyplot as plt
     from autograd import grad
     
    -def sigmoid(x):
    -    return 0.5 * (np.tanh(x / 2.) + 1)
    +# Note change from previous example
    +def CostOLS(y,X,theta):
    +    return np.sum((y-X @ theta)**2)
     
    -def logistic_predictions(weights, inputs):
    -    # Outputs probability of a label being true according to logistic model.
    -    return sigmoid(np.dot(inputs, weights))
    +n = 100
    +x = 2*np.random.rand(n,1)
    +y = 4+3*x+np.random.randn(n,1)
     
    -def training_loss(weights):
    -    # Training loss is the negative log-likelihood of the training labels.
    -    preds = logistic_predictions(weights, inputs)
    -    label_probabilities = preds * targets + (1 - preds) * (1 - targets)
    -    return -np.sum(np.log(label_probabilities))
    +X = np.c_[np.ones((n,1)), x]
    +XT_X = X.T @ X
    +theta_linreg = np.linalg.pinv(XT_X) @ (X.T @ y)
    +print("Own inversion")
    +print(theta_linreg)
    +# Hessian matrix
    +H = (2.0/n)* XT_X
    +EigValues, EigVectors = np.linalg.eig(H)
    +print(f"Eigenvalues of Hessian Matrix:{EigValues}")
     
    -# Build a toy dataset.
    -inputs = np.array([[0.52, 1.12,  0.77],
    -                   [0.88, -1.08, 0.15],
    -                   [0.52, 0.06, -1.30],
    -                   [0.74, -2.49, 1.39]])
    -targets = np.array([True, True, False, True])
    +theta = np.random.randn(2,1)
    +eta = 1.0/np.max(EigValues)
    +Niterations = 1000
     
    -# Define a function that returns gradients of training loss using Autograd.
    -training_gradient_fun = grad(training_loss)
    +# Note that we request the derivative wrt third argument (theta, 2 here)
    +training_gradient = grad(CostOLS,2)
     
    -# Optimize weights using gradient descent.
    -weights = np.array([0.0, 0.0, 0.0])
    -print("Initial loss:", training_loss(weights))
    -for i in range(100):
    -    weights -= training_gradient_fun(weights) * 0.01
    +for iter in range(Niterations):
    +    gradients = (1.0/n)*training_gradient(y, X, theta)
    +    theta -= eta*gradients
    +print("theta from own gd")
    +print(theta)
     
    -print("Trained loss:", training_loss(weights))
    +xnew = np.array([[0],[2]])
    +Xnew = np.c_[np.ones((2,1)), xnew]
    +ypredict = Xnew.dot(theta)
    +ypredict2 = Xnew.dot(theta_linreg)
    +
    +plt.plot(xnew, ypredict, "r-")
    +plt.plot(xnew, ypredict2, "b-")
    +plt.plot(x, y ,'ro')
    +plt.axis([0,2.0,0, 15.0])
    +plt.xlabel(r'$x$')
    +plt.ylabel(r'$y$')
    +plt.title(r'Random numbers ')
    +plt.show()
    +
    +n_epochs = 50
    +M = 5   #size of each minibatch
    +m = int(n/M) #number of minibatches
    +t0, t1 = 5, 50
    +def learning_schedule(t):
    +    return t0/(t+t1)
    +
    +theta = np.random.randn(2,1)
    +
    +for epoch in range(n_epochs):
    +# Can you figure out a better way of setting up the contributions to each batch?
    +    for i in range(m):
    +        random_index = np.random.randint(m)
    +        xi = X[random_index*M:random_index*M+M]
    +        yi = y[random_index*M:random_index*M+M]
    +        gradients = (2.0/M)*training_gradient(yi, xi, theta)
    +        eta = learning_schedule(epoch*m+i)
    +        theta = theta - eta*gradients
    +print("theta from own sdg")
    +print(theta)
     
    @@ -394,7 +440,7 @@ weights = np.41
  • 42
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs033.html b/doc/pub/week40/html/._week40-bs033.html index 4177d3578..be8eba4ba 100644 --- a/doc/pub/week40/html/._week40-bs033.html +++ b/doc/pub/week40/html/._week40-bs033.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,11 +316,63 @@ MathJax.Hub.Config({

     

     

     

    -

    Videos on Neural Networks

    +

    And Logistic Regression

    -Neural Networks demystified -Building Neural Networks from scratch + +
    +
    +
    +
    +
    +
    import autograd.numpy as np
    +from autograd import grad
    +
    +def sigmoid(x):
    +    return 0.5 * (np.tanh(x / 2.) + 1)
    +
    +def logistic_predictions(weights, inputs):
    +    # Outputs probability of a label being true according to logistic model.
    +    return sigmoid(np.dot(inputs, weights))
    +
    +def training_loss(weights):
    +    # Training loss is the negative log-likelihood of the training labels.
    +    preds = logistic_predictions(weights, inputs)
    +    label_probabilities = preds * targets + (1 - preds) * (1 - targets)
    +    return -np.sum(np.log(label_probabilities))
    +
    +# Build a toy dataset.
    +inputs = np.array([[0.52, 1.12,  0.77],
    +                   [0.88, -1.08, 0.15],
    +                   [0.52, 0.06, -1.30],
    +                   [0.74, -2.49, 1.39]])
    +targets = np.array([True, True, False, True])
    +
    +# Define a function that returns gradients of training loss using Autograd.
    +training_gradient_fun = grad(training_loss)
    +
    +# Optimize weights using gradient descent.
    +weights = np.array([0.0, 0.0, 0.0])
    +print("Initial loss:", training_loss(weights))
    +for i in range(100):
    +    weights -= training_gradient_fun(weights) * 0.01
    +
    +print("Trained loss:", training_loss(weights))
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    @@ -342,7 +399,7 @@ MathJax.Hub.Config({

  • 42
  • 43
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs034.html b/doc/pub/week40/html/._week40-bs034.html index 8d21a59c0..ecdb0dc47 100644 --- a/doc/pub/week40/html/._week40-bs034.html +++ b/doc/pub/week40/html/._week40-bs034.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,16 +316,11 @@ MathJax.Hub.Config({

     

     

     

    -

    Neural networks

    +

    Videos on Neural Networks

    -

    Artificial neural networks are computational systems that can learn to -perform tasks by considering examples, generally without being -programmed with any task-specific rules. It is supposed to mimic a -biological system, wherein neurons interact by sending signals in the -form of mathematical functions between layers. All layers can contain -an arbitrary number of neurons, and each connection is represented by -a weight variable. -

    +Neural Networks demystified + +Building Neural Networks from scratch

    @@ -347,7 +347,7 @@ a weight variable.

  • 43
  • 44
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs035.html b/doc/pub/week40/html/._week40-bs035.html index 77e17e4aa..4323c5806 100644 --- a/doc/pub/week40/html/._week40-bs035.html +++ b/doc/pub/week40/html/._week40-bs035.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,63 +316,15 @@ MathJax.Hub.Config({

     

     

     

    -

    Artificial neurons

    +

    Neural networks

    -

    The field of artificial neural networks has a long history of -development, and is closely connected with the advancement of computer -science and computers in general. A model of artificial neurons was -first developed by McCulloch and Pitts in 1943 to study signal -processing in the brain and has later been refined by others. The -general idea is to mimic neural networks in the human brain, which is -composed of billions of neurons that communicate with each other by -sending electrical signals. Each neuron accumulates its incoming -signals, which must exceed an activation threshold to yield an -output. If the threshold is not overcome, the neuron remains inactive, -i.e. has zero output. -

    - -

    This behaviour has inspired a simple mathematical model for an artificial neuron.

    - -$$ -\begin{equation} - y = f\left(\sum_{i=1}^n w_ix_i\right) = f(u) -\tag{6} -\end{equation} -$$ - -

    Here, the output \( y \) of the neuron is the value of its activation function, which have as input -a weighted sum of signals \( x_i, \dots ,x_n \) received by \( n \) other neurons. -

    - -

    Conceptually, it is helpful to divide neural networks into four -categories: -

    -
      -
    1. general purpose neural networks for supervised learning,
    2. -
    3. neural networks designed specifically for image processing, the most prominent example of this class being Convolutional Neural Networks (CNNs),
    4. -
    5. neural networks for sequential data such as Recurrent Neural Networks (RNNs), and
    6. -
    7. neural networks for unsupervised learning such as Deep Boltzmann Machines.
    8. -
    -

    In natural science, DNNs and CNNs have already found numerous -applications. In statistical physics, they have been applied to detect -phase transitions in 2D Ising and Potts models, lattice gauge -theories, and different phases of polymers, or solving the -Navier-Stokes equation in weather forecasting. Deep learning has also -found interesting applications in quantum physics. Various quantum -phase transitions can be detected and studied using DNNs and CNNs, -topological phases, and even non-equilibrium many-body -localization. Representing quantum states as DNNs quantum state -tomography are among some of the impressive achievements to reveal the -potential of DNNs to facilitate the study of quantum systems. -

    - -

    In quantum information theory, it has been shown that one can perform -gate decompositions with the help of neural. -

    - -

    The applications are not limited to the natural sciences. There is a -plethora of applications in essentially all disciplines, from the -humanities to life science and medicine. +

    Artificial neural networks are computational systems that can learn to +perform tasks by considering examples, generally without being +programmed with any task-specific rules. It is supposed to mimic a +biological system, wherein neurons interact by sending signals in the +form of mathematical functions between layers. All layers can contain +an arbitrary number of neurons, and each connection is represented by +a weight variable.

    @@ -395,7 +352,7 @@ humanities to life science and medicine.

  • 44
  • 45
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs036.html b/doc/pub/week40/html/._week40-bs036.html index 4919bb5f6..d98c0be60 100644 --- a/doc/pub/week40/html/._week40-bs036.html +++ b/doc/pub/week40/html/._week40-bs036.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,28 +316,63 @@ MathJax.Hub.Config({

     

     

     

    -

    Neural network types

    +

    Artificial neurons

    -

    An artificial neural network (ANN), is a computational model that -consists of layers of connected neurons, or nodes or units. We will -refer to these interchangeably as units or nodes, and sometimes as -neurons. +

    The field of artificial neural networks has a long history of +development, and is closely connected with the advancement of computer +science and computers in general. A model of artificial neurons was +first developed by McCulloch and Pitts in 1943 to study signal +processing in the brain and has later been refined by others. The +general idea is to mimic neural networks in the human brain, which is +composed of billions of neurons that communicate with each other by +sending electrical signals. Each neuron accumulates its incoming +signals, which must exceed an activation threshold to yield an +output. If the threshold is not overcome, the neuron remains inactive, +i.e. has zero output.

    -

    It is supposed to mimic a biological nervous system by letting each -neuron interact with other neurons by sending signals in the form of -mathematical functions between layers. A wide variety of different -ANNs have been developed, but most of them consist of an input layer, -an output layer and eventual layers in-between, called hidden -layers. All layers can contain an arbitrary number of nodes, and each -connection between two nodes is associated with a weight variable. +

    This behaviour has inspired a simple mathematical model for an artificial neuron.

    + +$$ +\begin{equation} + y = f\left(\sum_{i=1}^n w_ix_i\right) = f(u) +\tag{6} +\end{equation} +$$ + +

    Here, the output \( y \) of the neuron is the value of its activation function, which have as input +a weighted sum of signals \( x_i, \dots ,x_n \) received by \( n \) other neurons.

    -

    Neural networks (also called neural nets) are neural-inspired -nonlinear models for supervised learning. As we will see, neural nets -can be viewed as natural, more powerful extensions of supervised -learning methods such as linear and logistic regression and soft-max -methods we discussed earlier. +

    Conceptually, it is helpful to divide neural networks into four +categories: +

    +
      +
    1. general purpose neural networks for supervised learning,
    2. +
    3. neural networks designed specifically for image processing, the most prominent example of this class being Convolutional Neural Networks (CNNs),
    4. +
    5. neural networks for sequential data such as Recurrent Neural Networks (RNNs), and
    6. +
    7. neural networks for unsupervised learning such as Deep Boltzmann Machines.
    8. +
    +

    In natural science, DNNs and CNNs have already found numerous +applications. In statistical physics, they have been applied to detect +phase transitions in 2D Ising and Potts models, lattice gauge +theories, and different phases of polymers, or solving the +Navier-Stokes equation in weather forecasting. Deep learning has also +found interesting applications in quantum physics. Various quantum +phase transitions can be detected and studied using DNNs and CNNs, +topological phases, and even non-equilibrium many-body +localization. Representing quantum states as DNNs quantum state +tomography are among some of the impressive achievements to reveal the +potential of DNNs to facilitate the study of quantum systems. +

    + +

    In quantum information theory, it has been shown that one can perform +gate decompositions with the help of neural. +

    + +

    The applications are not limited to the natural sciences. There is a +plethora of applications in essentially all disciplines, from the +humanities to life science and medicine.

    @@ -360,7 +400,7 @@ methods we discussed earlier.

  • 45
  • 46
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs037.html b/doc/pub/week40/html/._week40-bs037.html index a5263dc0a..ee773cb5f 100644 --- a/doc/pub/week40/html/._week40-bs037.html +++ b/doc/pub/week40/html/._week40-bs037.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,19 +316,28 @@ MathJax.Hub.Config({

     

     

     

    -

    Feed-forward neural networks

    +

    Neural network types

    -

    The feed-forward neural network (FFNN) was the first and simplest type -of ANNs that were devised. In this network, the information moves in -only one direction: forward through the layers. +

    An artificial neural network (ANN), is a computational model that +consists of layers of connected neurons, or nodes or units. We will +refer to these interchangeably as units or nodes, and sometimes as +neurons.

    -

    Nodes are represented by circles, while the arrows display the -connections between the nodes, including the direction of information -flow. Additionally, each arrow corresponds to a weight variable -(figure to come). We observe that each node in a layer is connected -to all nodes in the subsequent layer, making this a so-called -fully-connected FFNN. +

    It is supposed to mimic a biological nervous system by letting each +neuron interact with other neurons by sending signals in the form of +mathematical functions between layers. A wide variety of different +ANNs have been developed, but most of them consist of an input layer, +an output layer and eventual layers in-between, called hidden +layers. All layers can contain an arbitrary number of nodes, and each +connection between two nodes is associated with a weight variable. +

    + +

    Neural networks (also called neural nets) are neural-inspired +nonlinear models for supervised learning. As we will see, neural nets +can be viewed as natural, more powerful extensions of supervised +learning methods such as linear and logistic regression and soft-max +methods we discussed earlier.

    @@ -351,7 +365,7 @@ to all nodes in the subsequent layer, making this a so-called

  • 46
  • 47
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs038.html b/doc/pub/week40/html/._week40-bs038.html index 72db16664..bf243d488 100644 --- a/doc/pub/week40/html/._week40-bs038.html +++ b/doc/pub/week40/html/._week40-bs038.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,27 +316,19 @@ MathJax.Hub.Config({

     

     

     

    -

    Convolutional Neural Network

    +

    Feed-forward neural networks

    -

    A different variant of FFNNs are convolutional neural networks -(CNNs), which have a connectivity pattern inspired by the animal -visual cortex. Individual neurons in the visual cortex only respond to -stimuli from small sub-regions of the visual field, called a receptive -field. This makes the neurons well-suited to exploit the strong -spatially local correlation present in natural images. The response of -each neuron can be approximated mathematically as a convolution -operation. (figure to come) +

    The feed-forward neural network (FFNN) was the first and simplest type +of ANNs that were devised. In this network, the information moves in +only one direction: forward through the layers.

    -

    Convolutional neural networks emulate the behaviour of neurons in the -visual cortex by enforcing a local connectivity pattern between -nodes of adjacent layers: Each node in a convolutional layer is -connected only to a subset of the nodes in the previous layer, in -contrast to the fully-connected FFNN. Often, CNNs consist of several -convolutional layers that learn local features of the input, with a -fully-connected layer at the end, which gathers all the local data and -produces the outputs. They have wide applications in image and video -recognition. +

    Nodes are represented by circles, while the arrows display the +connections between the nodes, including the direction of information +flow. Additionally, each arrow corresponds to a weight variable +(figure to come). We observe that each node in a layer is connected +to all nodes in the subsequent layer, making this a so-called +fully-connected FFNN.

    @@ -359,7 +356,7 @@ recognition.

  • 47
  • 48
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs039.html b/doc/pub/week40/html/._week40-bs039.html index 82530298d..ef512643a 100644 --- a/doc/pub/week40/html/._week40-bs039.html +++ b/doc/pub/week40/html/._week40-bs039.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,18 +316,27 @@ MathJax.Hub.Config({

     

     

     

    -

    Recurrent neural networks

    +

    Convolutional Neural Network

    -

    So far we have only mentioned ANNs where information flows in one -direction: forward. Recurrent neural networks on the other hand, -have connections between nodes that form directed cycles. This -creates a form of internal memory which are able to capture -information on what has been calculated before; the output is -dependent on the previous computations. Recurrent NNs make use of -sequential information by performing the same task for every element -in a sequence, where each element depends on previous elements. An -example of such information is sentences, making recurrent NNs -especially well-suited for handwriting and speech recognition. +

    A different variant of FFNNs are convolutional neural networks +(CNNs), which have a connectivity pattern inspired by the animal +visual cortex. Individual neurons in the visual cortex only respond to +stimuli from small sub-regions of the visual field, called a receptive +field. This makes the neurons well-suited to exploit the strong +spatially local correlation present in natural images. The response of +each neuron can be approximated mathematically as a convolution +operation. (figure to come) +

    + +

    Convolutional neural networks emulate the behaviour of neurons in the +visual cortex by enforcing a local connectivity pattern between +nodes of adjacent layers: Each node in a convolutional layer is +connected only to a subset of the nodes in the previous layer, in +contrast to the fully-connected FFNN. Often, CNNs consist of several +convolutional layers that learn local features of the input, with a +fully-connected layer at the end, which gathers all the local data and +produces the outputs. They have wide applications in image and video +recognition.

    @@ -350,7 +364,7 @@ especially well-suited for handwriting and speech recognition.

  • 48
  • 49
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs040.html b/doc/pub/week40/html/._week40-bs040.html index df3303d0a..c8def1c52 100644 --- a/doc/pub/week40/html/._week40-bs040.html +++ b/doc/pub/week40/html/._week40-bs040.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,18 +316,18 @@ MathJax.Hub.Config({

     

     

     

    -

    Other types of networks

    +

    Recurrent neural networks

    -

    There are many other kinds of ANNs that have been developed. One type -that is specifically designed for interpolation in multidimensional -space is the radial basis function (RBF) network. RBFs are typically -made up of three layers: an input layer, a hidden layer with -non-linear radial symmetric activation functions and a linear output -layer (''linear'' here means that each node in the output layer has a -linear activation function). The layers are normally fully-connected -and there are no cycles, thus RBFs can be viewed as a type of -fully-connected FFNN. They are however usually treated as a separate -type of NN due the unusual activation functions. +

    So far we have only mentioned ANNs where information flows in one +direction: forward. Recurrent neural networks on the other hand, +have connections between nodes that form directed cycles. This +creates a form of internal memory which are able to capture +information on what has been calculated before; the output is +dependent on the previous computations. Recurrent NNs make use of +sequential information by performing the same task for every element +in a sequence, where each element depends on previous elements. An +example of such information is sentences, making recurrent NNs +especially well-suited for handwriting and speech recognition.

    @@ -350,7 +355,7 @@ type of NN due the unusual activation functions.

  • 49
  • 50
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs041.html b/doc/pub/week40/html/._week40-bs041.html index 46990f872..f4c68b793 100644 --- a/doc/pub/week40/html/._week40-bs041.html +++ b/doc/pub/week40/html/._week40-bs041.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,16 +316,20 @@ MathJax.Hub.Config({

     

     

     

    -

    Multilayer perceptrons

    +

    Other types of networks

    -

    One uses often so-called fully-connected feed-forward neural networks -with three or more layers (an input layer, one or more hidden layers -and an output layer) consisting of neurons that have non-linear -activation functions. +

    There are many other kinds of ANNs that have been developed. One type +that is specifically designed for interpolation in multidimensional +space is the radial basis function (RBF) network. RBFs are typically +made up of three layers: an input layer, a hidden layer with +non-linear radial symmetric activation functions and a linear output +layer (''linear'' here means that each node in the output layer has a +linear activation function). The layers are normally fully-connected +and there are no cycles, thus RBFs can be viewed as a type of +fully-connected FFNN. They are however usually treated as a separate +type of NN due the unusual activation functions.

    -

    Such networks are often called multilayer perceptrons (MLPs).

    -

      @@ -346,7 +355,7 @@ activation functions.
    • 50
    • 51
    • ...
    • -
    • 68
    • +
    • 69
    • »
    diff --git a/doc/pub/week40/html/._week40-bs042.html b/doc/pub/week40/html/._week40-bs042.html index ec1e4defd..261e28bad 100644 --- a/doc/pub/week40/html/._week40-bs042.html +++ b/doc/pub/week40/html/._week40-bs042.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,20 +316,15 @@ MathJax.Hub.Config({

     

     

     

    -

    Why multilayer perceptrons?

    +

    Multilayer perceptrons

    -

    According to the Universal approximation theorem, a feed-forward -neural network with just a single hidden layer containing a finite -number of neurons can approximate a continuous multidimensional -function to arbitrary accuracy, assuming the activation function for -the hidden layer is a non-constant, bounded and -monotonically-increasing continuous function. +

    One uses often so-called fully-connected feed-forward neural networks +with three or more layers (an input layer, one or more hidden layers +and an output layer) consisting of neurons that have non-linear +activation functions.

    -

    Note that the requirements on the activation function only applies to -the hidden layer, the output nodes are always assumed to be linear, so -as to not restrict the range of output values. -

    +

    Such networks are often called multilayer perceptrons (MLPs).

    @@ -351,7 +351,7 @@ as to not restrict the range of output values.

  • 51
  • 52
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs043.html b/doc/pub/week40/html/._week40-bs043.html index cbf3e13ca..5f14f3c55 100644 --- a/doc/pub/week40/html/._week40-bs043.html +++ b/doc/pub/week40/html/._week40-bs043.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,15 +316,20 @@ MathJax.Hub.Config({

     

     

     

    -

    Illustration of a single perceptropn model and a multi-perceptron model

    +

    Why multilayer perceptrons?

    -
    -
    -
    -

    Figure 1: In a) we show a single perceptron model while in b) we dispay a network with two hidden layers, an input layer and an output layer.

    -
    -

    -
    +

    According to the Universal approximation theorem, a feed-forward +neural network with just a single hidden layer containing a finite +number of neurons can approximate a continuous multidimensional +function to arbitrary accuracy, assuming the activation function for +the hidden layer is a non-constant, bounded and +monotonically-increasing continuous function. +

    + +

    Note that the requirements on the activation function only applies to +the hidden layer, the output nodes are always assumed to be linear, so +as to not restrict the range of output values. +

    @@ -346,7 +356,7 @@ MathJax.Hub.Config({

  • 52
  • 53
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs044.html b/doc/pub/week40/html/._week40-bs044.html index d5e2dd03a..024a02b5e 100644 --- a/doc/pub/week40/html/._week40-bs044.html +++ b/doc/pub/week40/html/._week40-bs044.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,68 +316,15 @@ MathJax.Hub.Config({

     

     

     

    -

    Examples of XOR, OR and AND gates

    +

    Illustration of a single perceptropn model and a multi-perceptron model

    -

    Let us first try to fit various gates using standard linear -regression. The gates we are thinking of are the classical XOR, OR and -AND gates, well-known elements in computer science. The tables here -show how we can set up the inputs \( x_1 \) and \( x_2 \) in order to yield a -specific target \( y_i \). -

    - - - -
    -
    -
    -
    -
    -
    """
    -Simple code that tests XOR, OR and AND gates with linear regression
    -"""
    -
    -import numpy as np
    -# Design matrix
    -X = np.array([ [1, 0, 0], [1, 0, 1], [1, 1, 0],[1, 1, 1]],dtype=np.float64)
    -print(f"The X.TX  matrix:{X.T @ X}")
    -Xinv = np.linalg.pinv(X.T @ X)
    -print(f"The invers of X.TX  matrix:{Xinv}")
    -
    -# The XOR gate 
    -yXOR = np.array( [ 0, 1 ,1, 0])
    -ThetaXOR  = Xinv @ X.T @ yXOR
    -print(f"The values of theta for the XOR gate:{ThetaXOR}")
    -print(f"The linear regression prediction  for the XOR gate:{X @ ThetaXOR}")
    -
    -
    -# The OR gate 
    -yOR = np.array( [ 0, 1 ,1, 1])
    -ThetaOR  = Xinv @ X.T @ yOR
    -print(f"The values of theta for the OR gate:{ThetaOR}")
    -print(f"The linear regression prediction  for the OR gate:{X @ ThetaOR}")
    -
    -
    -# The OR gate 
    -yAND = np.array( [ 0, 0 ,0, 1])
    -ThetaAND  = Xinv @ X.T @ yAND
    -print(f"The values of theta for the AND gate:{ThetaAND}")
    -print(f"The linear regression prediction  for the AND gate:{X @ ThetaAND}")
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -

    What is happening here?

    +
    +
    +
    +

    Figure 1: In a) we show a single perceptron model while in b) we dispay a network with two hidden layers, an input layer and an output layer.

    +
    +

    +

    @@ -399,7 +351,7 @@ ThetaAND = Xinv 53

  • 54
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs045.html b/doc/pub/week40/html/._week40-bs045.html index 5140d85b9..b7a020b82 100644 --- a/doc/pub/week40/html/._week40-bs045.html +++ b/doc/pub/week40/html/._week40-bs045.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,7 +316,14 @@ MathJax.Hub.Config({

     

     

     

    -

    Does Logistic Regression do a better Job?

    +

    Examples of XOR, OR and AND gates

    + +

    Let us first try to fit various gates using standard linear +regression. The gates we are thinking of are the classical XOR, OR and +AND gates, well-known elements in computer science. The tables here +show how we can set up the inputs \( x_1 \) and \( x_2 \) in order to yield a +specific target \( y_i \). +

    @@ -321,14 +333,10 @@ MathJax.Hub.Config({
    """
    -Simple code that tests XOR and OR gates with linear regression
    -and logistic regression
    +Simple code that tests XOR, OR and AND gates with linear regression
     """
     
    -import matplotlib.pyplot as plt
    -from sklearn.linear_model import LogisticRegression
     import numpy as np
    -
     # Design matrix
     X = np.array([ [1, 0, 0], [1, 0, 1], [1, 1, 0],[1, 1, 1]],dtype=np.float64)
     print(f"The X.TX  matrix:{X.T @ X}")
    @@ -354,21 +362,6 @@ yAND = np.= Xinv @ X.T @ yAND
     print(f"The values of theta for the AND gate:{ThetaAND}")
     print(f"The linear regression prediction  for the AND gate:{X @ ThetaAND}")
    -
    -# Now we change to logistic regression
    -
    -
    -# Logistic Regression
    -logreg = LogisticRegression()
    -logreg.fit(X, yOR)
    -print("Test set accuracy with Logistic Regression for OR gate: {:.2f}".format(logreg.score(X,yOR)))
    -
    -logreg.fit(X, yXOR)
    -print("Test set accuracy with Logistic Regression for XOR gate: {:.2f}".format(logreg.score(X,yXOR)))
    -
    -
    -logreg.fit(X, yAND)
    -print("Test set accuracy with Logistic Regression for AND gate: {:.2f}".format(logreg.score(X,yAND)))
     
    @@ -384,7 +377,7 @@ logreg.fit(X, yAND)
    -

    Not exactly impressive, but somewhat better.

    +

    What is happening here?

    @@ -411,7 +404,7 @@ logreg.fit(X, yAND)

  • 54
  • 55
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs046.html b/doc/pub/week40/html/._week40-bs046.html index 2f21a1e26..331ab6594 100644 --- a/doc/pub/week40/html/._week40-bs046.html +++ b/doc/pub/week40/html/._week40-bs046.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,7 +316,7 @@ MathJax.Hub.Config({

     

     

     

    -

    Adding Neural Networks

    +

    Does Logistic Regression do a better Job?

    @@ -320,14 +325,55 @@ MathJax.Hub.Config({
    -
    # and now neural networks with Scikit-Learn and the XOR
    +  
    """
    +Simple code that tests XOR and OR gates with linear regression
    +and logistic regression
    +"""
     
    -from sklearn.neural_network import MLPClassifier
    -from sklearn.datasets import make_classification
    -X, yXOR = make_classification(n_samples=100, random_state=1)
    -FFNN = MLPClassifier(random_state=1, max_iter=300).fit(X, yXOR)
    -FFNN.predict_proba(X)
    -print(f"Test set accuracy with Feed Forward Neural Network  for XOR gate:{FFNN.score(X, yXOR)}")
    +import matplotlib.pyplot as plt
    +from sklearn.linear_model import LogisticRegression
    +import numpy as np
    +
    +# Design matrix
    +X = np.array([ [1, 0, 0], [1, 0, 1], [1, 1, 0],[1, 1, 1]],dtype=np.float64)
    +print(f"The X.TX  matrix:{X.T @ X}")
    +Xinv = np.linalg.pinv(X.T @ X)
    +print(f"The invers of X.TX  matrix:{Xinv}")
    +
    +# The XOR gate 
    +yXOR = np.array( [ 0, 1 ,1, 0])
    +ThetaXOR  = Xinv @ X.T @ yXOR
    +print(f"The values of theta for the XOR gate:{ThetaXOR}")
    +print(f"The linear regression prediction  for the XOR gate:{X @ ThetaXOR}")
    +
    +
    +# The OR gate 
    +yOR = np.array( [ 0, 1 ,1, 1])
    +ThetaOR  = Xinv @ X.T @ yOR
    +print(f"The values of theta for the OR gate:{ThetaOR}")
    +print(f"The linear regression prediction  for the OR gate:{X @ ThetaOR}")
    +
    +
    +# The OR gate 
    +yAND = np.array( [ 0, 0 ,0, 1])
    +ThetaAND  = Xinv @ X.T @ yAND
    +print(f"The values of theta for the AND gate:{ThetaAND}")
    +print(f"The linear regression prediction  for the AND gate:{X @ ThetaAND}")
    +
    +# Now we change to logistic regression
    +
    +
    +# Logistic Regression
    +logreg = LogisticRegression()
    +logreg.fit(X, yOR)
    +print("Test set accuracy with Logistic Regression for OR gate: {:.2f}".format(logreg.score(X,yOR)))
    +
    +logreg.fit(X, yXOR)
    +print("Test set accuracy with Logistic Regression for XOR gate: {:.2f}".format(logreg.score(X,yXOR)))
    +
    +
    +logreg.fit(X, yAND)
    +print("Test set accuracy with Logistic Regression for AND gate: {:.2f}".format(logreg.score(X,yAND)))
     
    @@ -343,6 +389,7 @@ FFNN.predict_proba(X)
    +

    Not exactly impressive, but somewhat better.

    @@ -369,7 +416,7 @@ FFNN.predict_proba(X)

  • 55
  • 56
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs047.html b/doc/pub/week40/html/._week40-bs047.html index bfac964c1..5bce33dd4 100644 --- a/doc/pub/week40/html/._week40-bs047.html +++ b/doc/pub/week40/html/._week40-bs047.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,20 +316,38 @@ MathJax.Hub.Config({

     

     

     

    -

    Mathematical model

    +

    Adding Neural Networks

    -

    The output \( y \) is produced via the activation function \( f \)

    -$$ - y = f\left(\sum_{i=1}^n w_ix_i + b_i\right) = f(z), -$$ -

    This function receives \( x_i \) as inputs. -Here the activation \( z=(\sum_{i=1}^n w_ix_i+b_i) \). -In an FFNN of such neurons, the inputs \( x_i \) are the outputs of -the neurons in the preceding layer. Furthermore, an MLP is -fully-connected, which means that each neuron receives a weighted sum -of the outputs of all neurons in the previous layer. -

    + +
    +
    +
    +
    +
    +
    # and now neural networks with Scikit-Learn and the XOR
    +
    +from sklearn.neural_network import MLPClassifier
    +from sklearn.datasets import make_classification
    +X, yXOR = make_classification(n_samples=100, random_state=1)
    +FFNN = MLPClassifier(random_state=1, max_iter=300).fit(X, yXOR)
    +FFNN.predict_proba(X)
    +print(f"Test set accuracy with Feed Forward Neural Network  for XOR gate:{FFNN.score(X, yXOR)}")
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    @@ -351,7 +374,7 @@ of the outputs of all neurons in the previous layer.

  • 56
  • 57
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs048.html b/doc/pub/week40/html/._week40-bs048.html index 3b0595a90..d51073b75 100644 --- a/doc/pub/week40/html/._week40-bs048.html +++ b/doc/pub/week40/html/._week40-bs048.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -313,45 +318,17 @@ MathJax.Hub.Config({

    Mathematical model

    -

    First, for each node \( i \) in the first hidden layer, we calculate a weighted sum \( z_i^1 \) of the input coordinates \( x_j \),

    - +

    The output \( y \) is produced via the activation function \( f \)

    $$ -\begin{equation} z_i^1 = \sum_{j=1}^{M} w_{ij}^1 x_j + b_i^1 -\tag{7} -\end{equation} + y = f\left(\sum_{i=1}^n w_ix_i + b_i\right) = f(z), $$ -

    Here \( b_i \) is the so-called bias which is normally needed in -case of zero activation weights or inputs. How to fix the biases and -the weights will be discussed below. The value of \( z_i^1 \) is the -argument to the activation function \( f_i \) of each node \( i \), The -variable \( M \) stands for all possible inputs to a given node \( i \) in the -first layer. We define the output \( y_i^1 \) of all neurons in layer 1 as -

    - -$$ -\begin{equation} - y_i^1 = f(z_i^1) = f\left(\sum_{j=1}^M w_{ij}^1 x_j + b_i^1\right) -\tag{8} -\end{equation} -$$ - -

    where we assume that all nodes in the same layer have identical -activation functions, hence the notation \( f \). In general, we could assume in the more general case that different layers have different activation functions. -In this case we would identify these functions with a superscript \( l \) for the \( l \)-th layer, -

    - -$$ -\begin{equation} - y_i^l = f^l(u_i^l) = f^l\left(\sum_{j=1}^{N_{l-1}} w_{ij}^l y_j^{l-1} + b_i^l\right) -\tag{9} -\end{equation} -$$ - -

    where \( N_l \) is the number of nodes in layer \( l \). When the output of -all the nodes in the first hidden layer are computed, the values of -the subsequent layer can be calculated and so forth until the output -is obtained. +

    This function receives \( x_i \) as inputs. +Here the activation \( z=(\sum_{i=1}^n w_ix_i+b_i) \). +In an FFNN of such neurons, the inputs \( x_i \) are the outputs of +the neurons in the preceding layer. Furthermore, an MLP is +fully-connected, which means that each neuron receives a weighted sum +of the outputs of all neurons in the previous layer.

    @@ -379,7 +356,7 @@ is obtained.

  • 57
  • 58
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs049.html b/doc/pub/week40/html/._week40-bs049.html index 85801d926..2541dea00 100644 --- a/doc/pub/week40/html/._week40-bs049.html +++ b/doc/pub/week40/html/._week40-bs049.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -313,29 +318,46 @@ MathJax.Hub.Config({

    Mathematical model

    -

    The output of neuron \( i \) in layer 2 is thus,

    +

    First, for each node \( i \) in the first hidden layer, we calculate a weighted sum \( z_i^1 \) of the input coordinates \( x_j \),

    $$ -\begin{align} - y_i^2 &= f^2\left(\sum_{j=1}^N w_{ij}^2 y_j^1 + b_i^2\right) -\tag{10}\\ - &= f^2\left[\sum_{j=1}^N w_{ij}^2f^1\left(\sum_{k=1}^M w_{jk}^1 x_k + b_j^1\right) + b_i^2\right] -\tag{11} -\end{align} +\begin{equation} z_i^1 = \sum_{j=1}^{M} w_{ij}^1 x_j + b_i^1 +\tag{7} +\end{equation} $$ -

    where we have substituted \( y_k^1 \) with the inputs \( x_k \). Finally, the ANN output reads

    +

    Here \( b_i \) is the so-called bias which is normally needed in +case of zero activation weights or inputs. How to fix the biases and +the weights will be discussed below. The value of \( z_i^1 \) is the +argument to the activation function \( f_i \) of each node \( i \), The +variable \( M \) stands for all possible inputs to a given node \( i \) in the +first layer. We define the output \( y_i^1 \) of all neurons in layer 1 as +

    $$ -\begin{align} - y_i^3 &= f^3\left(\sum_{j=1}^N w_{ij}^3 y_j^2 + b_i^3\right) -\tag{12}\\ - &= f_3\left[\sum_{j} w_{ij}^3 f^2\left(\sum_{k} w_{jk}^2 f^1\left(\sum_{m} w_{km}^1 x_m + b_k^1\right) + b_j^2\right) - + b_1^3\right] -\tag{13} -\end{align} +\begin{equation} + y_i^1 = f(z_i^1) = f\left(\sum_{j=1}^M w_{ij}^1 x_j + b_i^1\right) +\tag{8} +\end{equation} $$ +

    where we assume that all nodes in the same layer have identical +activation functions, hence the notation \( f \). In general, we could assume in the more general case that different layers have different activation functions. +In this case we would identify these functions with a superscript \( l \) for the \( l \)-th layer, +

    + +$$ +\begin{equation} + y_i^l = f^l(u_i^l) = f^l\left(\sum_{j=1}^{N_{l-1}} w_{ij}^l y_j^{l-1} + b_i^l\right) +\tag{9} +\end{equation} +$$ + +

    where \( N_l \) is the number of nodes in layer \( l \). When the output of +all the nodes in the first hidden layer are computed, the values of +the subsequent layer can be calculated and so forth until the output +is obtained. +

    @@ -362,7 +384,7 @@ $$

  • 58
  • 59
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs050.html b/doc/pub/week40/html/._week40-bs050.html index f31d8acff..ec27dba50 100644 --- a/doc/pub/week40/html/._week40-bs050.html +++ b/doc/pub/week40/html/._week40-bs050.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -313,20 +318,29 @@ MathJax.Hub.Config({

    Mathematical model

    -

    We can generalize this expression to an MLP with \( l \) hidden -layers. The complete functional form is, -

    +

    The output of neuron \( i \) in layer 2 is thus,

    $$ \begin{align} -&y^{l+1}_i = f^{l+1}\left[\!\sum_{j=1}^{N_l} w_{ij}^3 f^l\left(\sum_{k=1}^{N_{l-1}}w_{jk}^{l-1}\left(\dots f^1\left(\sum_{n=1}^{N_0} w_{mn}^1 x_n+ b_m^1\right)\dots\right)+b_k^2\right)+b_1^3\right] && -\tag{14} + y_i^2 &= f^2\left(\sum_{j=1}^N w_{ij}^2 y_j^1 + b_i^2\right) +\tag{10}\\ + &= f^2\left[\sum_{j=1}^N w_{ij}^2f^1\left(\sum_{k=1}^M w_{jk}^1 x_k + b_j^1\right) + b_i^2\right] +\tag{11} +\end{align} +$$ + +

    where we have substituted \( y_k^1 \) with the inputs \( x_k \). Finally, the ANN output reads

    + +$$ +\begin{align} + y_i^3 &= f^3\left(\sum_{j=1}^N w_{ij}^3 y_j^2 + b_i^3\right) +\tag{12}\\ + &= f_3\left[\sum_{j} w_{ij}^3 f^2\left(\sum_{k} w_{jk}^2 f^1\left(\sum_{m} w_{km}^1 x_m + b_k^1\right) + b_j^2\right) + + b_1^3\right] +\tag{13} \end{align} $$ -

    which illustrates a basic property of MLPs: The only independent -variables are the input values \( x_n \). -

    @@ -353,7 +367,7 @@ variables are the input values \( x_n \).

  • 59
  • 60
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs051.html b/doc/pub/week40/html/._week40-bs051.html index 87eb6b792..b97a59fd4 100644 --- a/doc/pub/week40/html/._week40-bs051.html +++ b/doc/pub/week40/html/._week40-bs051.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -313,28 +318,19 @@ MathJax.Hub.Config({

    Mathematical model

    -

    This confirms that an MLP, despite its quite convoluted mathematical -form, is nothing more than an analytic function, specifically a -mapping of real-valued vectors \( \hat{x} \in \mathbb{R}^n \rightarrow -\hat{y} \in \mathbb{R}^m \). -

    - -

    Furthermore, the flexibility and universality of an MLP can be -illustrated by realizing that the expression is essentially a nested -sum of scaled activation functions of the form +

    We can generalize this expression to an MLP with \( l \) hidden +layers. The complete functional form is,

    $$ -\begin{equation} - f(x) = c_1 f(c_2 x + c_3) + c_4 -\tag{15} -\end{equation} +\begin{align} +&y^{l+1}_i = f^{l+1}\left[\!\sum_{j=1}^{N_l} w_{ij}^3 f^l\left(\sum_{k=1}^{N_{l-1}}w_{jk}^{l-1}\left(\dots f^1\left(\sum_{n=1}^{N_0} w_{mn}^1 x_n+ b_m^1\right)\dots\right)+b_k^2\right)+b_1^3\right] && +\tag{14} +\end{align} $$ -

    where the parameters \( c_i \) are weights and biases. By adjusting these -parameters, the activation functions can be shifted up and down or -left and right, change slope or be rescaled which is the key to the -flexibility of a neural network. +

    which illustrates a basic property of MLPs: The only independent +variables are the input values \( x_n \).

    @@ -362,7 +358,7 @@ flexibility of a neural network.

  • 60
  • 61
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs052.html b/doc/pub/week40/html/._week40-bs052.html index 4f2794079..2d1d02b86 100644 --- a/doc/pub/week40/html/._week40-bs052.html +++ b/doc/pub/week40/html/._week40-bs052.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,41 +316,31 @@ MathJax.Hub.Config({

     

     

     

    -

    Matrix-vector notation

    +

    Mathematical model

    -

    We can introduce a more convenient notation for the activations in an A NN.

    - -

    Additionally, we can represent the biases and activations -as layer-wise column vectors \( \hat{b}_l \) and \( \hat{y}_l \), so that the \( i \)-th element of each vector -is the bias \( b_i^l \) and activation \( y_i^l \) of node \( i \) in layer \( l \) respectively. +

    This confirms that an MLP, despite its quite convoluted mathematical +form, is nothing more than an analytic function, specifically a +mapping of real-valued vectors \( \hat{x} \in \mathbb{R}^n \rightarrow +\hat{y} \in \mathbb{R}^m \).

    -

    We have that \( \mathrm{W}_l \) is an \( N_{l-1} \times N_l \) matrix, while \( \hat{b}_l \) and \( \hat{y}_l \) are \( N_l \times 1 \) column vectors. -With this notation, the sum becomes a matrix-vector multiplication, and we can write -the equation for the activations of hidden layer 2 (assuming three nodes for simplicity) as +

    Furthermore, the flexibility and universality of an MLP can be +illustrated by realizing that the expression is essentially a nested +sum of scaled activation functions of the form

    + $$ \begin{equation} - \hat{y}_2 = f_2(\mathrm{W}_2 \hat{y}_{1} + \hat{b}_{2}) = - f_2\left(\left[\begin{array}{ccc} - w^2_{11} &w^2_{12} &w^2_{13} \\ - w^2_{21} &w^2_{22} &w^2_{23} \\ - w^2_{31} &w^2_{32} &w^2_{33} \\ - \end{array} \right] \cdot - \left[\begin{array}{c} - y^1_1 \\ - y^1_2 \\ - y^1_3 \\ - \end{array}\right] + - \left[\begin{array}{c} - b^2_1 \\ - b^2_2 \\ - b^2_3 \\ - \end{array}\right]\right). -\tag{16} + f(x) = c_1 f(c_2 x + c_3) + c_4 +\tag{15} \end{equation} $$ +

    where the parameters \( c_i \) are weights and biases. By adjusting these +parameters, the activation functions can be shifted up and down or +left and right, change slope or be rescaled which is the key to the +flexibility of a neural network. +

    @@ -372,7 +367,7 @@ $$

  • 61
  • 62
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs053.html b/doc/pub/week40/html/._week40-bs053.html index c0e54e9bc..850e113f2 100644 --- a/doc/pub/week40/html/._week40-bs053.html +++ b/doc/pub/week40/html/._week40-bs053.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,24 +316,41 @@ MathJax.Hub.Config({

     

     

     

    -

    Matrix-vector notation and activation

    +

    Matrix-vector notation

    -

    The activation of node \( i \) in layer 2 is

    +

    We can introduce a more convenient notation for the activations in an A NN.

    +

    Additionally, we can represent the biases and activations +as layer-wise column vectors \( \hat{b}_l \) and \( \hat{y}_l \), so that the \( i \)-th element of each vector +is the bias \( b_i^l \) and activation \( y_i^l \) of node \( i \) in layer \( l \) respectively. +

    + +

    We have that \( \mathrm{W}_l \) is an \( N_{l-1} \times N_l \) matrix, while \( \hat{b}_l \) and \( \hat{y}_l \) are \( N_l \times 1 \) column vectors. +With this notation, the sum becomes a matrix-vector multiplication, and we can write +the equation for the activations of hidden layer 2 (assuming three nodes for simplicity) as +

    $$ \begin{equation} - y^2_i = f_2\Bigr(w^2_{i1}y^1_1 + w^2_{i2}y^1_2 + w^2_{i3}y^1_3 + b^2_i\Bigr) = - f_2\left(\sum_{j=1}^3 w^2_{ij} y_j^1 + b^2_i\right). -\tag{17} + \hat{y}_2 = f_2(\mathrm{W}_2 \hat{y}_{1} + \hat{b}_{2}) = + f_2\left(\left[\begin{array}{ccc} + w^2_{11} &w^2_{12} &w^2_{13} \\ + w^2_{21} &w^2_{22} &w^2_{23} \\ + w^2_{31} &w^2_{32} &w^2_{33} \\ + \end{array} \right] \cdot + \left[\begin{array}{c} + y^1_1 \\ + y^1_2 \\ + y^1_3 \\ + \end{array}\right] + + \left[\begin{array}{c} + b^2_1 \\ + b^2_2 \\ + b^2_3 \\ + \end{array}\right]\right). +\tag{16} \end{equation} $$ -

    This is not just a convenient and compact notation, but also a useful -and intuitive way to think about MLPs: The output is calculated by a -series of matrix-vector multiplications and vector additions that are -used as input to the activation functions. For each operation -\( \mathrm{W}_l \hat{y}_{l-1} \) we move forward one layer. -

    @@ -355,7 +377,7 @@ used as input to the activation functions. For each operation

  • 62
  • 63
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs054.html b/doc/pub/week40/html/._week40-bs054.html index ca03ede69..bf0aba6a7 100644 --- a/doc/pub/week40/html/._week40-bs054.html +++ b/doc/pub/week40/html/._week40-bs054.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,20 +316,25 @@ MathJax.Hub.Config({

     

     

     

    -

    Activation functions

    +

    Matrix-vector notation and activation

    -

    A property that characterizes a neural network, other than its -connectivity, is the choice of activation function(s). As described -in, the following restrictions are imposed on an activation function -for a FFNN to fulfill the universal approximation theorem +

    The activation of node \( i \) in layer 2 is

    + +$$ +\begin{equation} + y^2_i = f_2\Bigr(w^2_{i1}y^1_1 + w^2_{i2}y^1_2 + w^2_{i3}y^1_3 + b^2_i\Bigr) = + f_2\left(\sum_{j=1}^3 w^2_{ij} y_j^1 + b^2_i\right). +\tag{17} +\end{equation} +$$ + +

    This is not just a convenient and compact notation, but also a useful +and intuitive way to think about MLPs: The output is calculated by a +series of matrix-vector multiplications and vector additions that are +used as input to the activation functions. For each operation +\( \mathrm{W}_l \hat{y}_{l-1} \) we move forward one layer.

    -
      -
    • Non-constant
    • -
    • Bounded
    • -
    • Monotonically-increasing
    • -
    • Continuous
    • -

      @@ -350,7 +360,7 @@ for a FFNN to fulfill the universal approximation theorem
    • 63
    • 64
    • ...
    • -
    • 68
    • +
    • 69
    • »
    diff --git a/doc/pub/week40/html/._week40-bs055.html b/doc/pub/week40/html/._week40-bs055.html index e6c383b8e..168bc05fe 100644 --- a/doc/pub/week40/html/._week40-bs055.html +++ b/doc/pub/week40/html/._week40-bs055.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,29 +316,20 @@ MathJax.Hub.Config({

     

     

     

    -

    Activation functions, Logistic and Hyperbolic ones

    +

    Activation functions

    -

    The second requirement excludes all linear functions. Furthermore, in -a MLP with only linear activation functions, each layer simply -performs a linear transformation of its inputs. +

    A property that characterizes a neural network, other than its +connectivity, is the choice of activation function(s). As described +in, the following restrictions are imposed on an activation function +for a FFNN to fulfill the universal approximation theorem

    -

    Regardless of the number of layers, the output of the NN will be -nothing but a linear function of the inputs. Thus we need to introduce -some kind of non-linearity to the NN to be able to fit non-linear -functions Typical examples are the logistic Sigmoid -

    - -$$ - f(x) = \frac{1}{1 + e^{-x}}, -$$ - -

    and the hyperbolic tangent function

    -$$ - f(x) = \tanh(x) -$$ - - +
      +
    • Non-constant
    • +
    • Bounded
    • +
    • Monotonically-increasing
    • +
    • Continuous
    • +

    diff --git a/doc/pub/week40/html/._week40-bs056.html b/doc/pub/week40/html/._week40-bs056.html index 88fc1a0d7..7331e07d2 100644 --- a/doc/pub/week40/html/._week40-bs056.html +++ b/doc/pub/week40/html/._week40-bs056.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,107 +316,27 @@ MathJax.Hub.Config({

     

     

     

    -

    Relevance

    +

    Activation functions, Logistic and Hyperbolic ones

    -

    The sigmoid function are more biologically plausible because the -output of inactive neurons are zero. Such activation function are -called one-sided. However, it has been shown that the hyperbolic -tangent performs better than the sigmoid for training MLPs. has -become the most popular for deep neural networks +

    The second requirement excludes all linear functions. Furthermore, in +a MLP with only linear activation functions, each layer simply +performs a linear transformation of its inputs.

    +

    Regardless of the number of layers, the output of the NN will be +nothing but a linear function of the inputs. Thus we need to introduce +some kind of non-linearity to the NN to be able to fit non-linear +functions Typical examples are the logistic Sigmoid +

    - -
    -
    -
    -
    -
    -
    """The sigmoid function (or the logistic curve) is a 
    -function that takes any real number, z, and outputs a number (0,1).
    -It is useful in neural networks for assigning weights on a relative scale.
    -The value z is the weighted sum of parameters involved in the learning algorithm."""
    +$$
    + f(x) = \frac{1}{1 + e^{-x}},
    +$$
     
    -import numpy
    -import matplotlib.pyplot as plt
    -import math as mt
    -
    -z = numpy.arange(-5, 5, .1)
    -sigma_fn = numpy.vectorize(lambda z: 1/(1+numpy.exp(-z)))
    -sigma = sigma_fn(z)
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -ax.plot(z, sigma)
    -ax.set_ylim([-0.1, 1.1])
    -ax.set_xlim([-5,5])
    -ax.grid(True)
    -ax.set_xlabel('z')
    -ax.set_title('sigmoid function')
    -
    -plt.show()
    -
    -"""Step Function"""
    -z = numpy.arange(-5, 5, .02)
    -step_fn = numpy.vectorize(lambda z: 1.0 if z >= 0.0 else 0.0)
    -step = step_fn(z)
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -ax.plot(z, step)
    -ax.set_ylim([-0.5, 1.5])
    -ax.set_xlim([-5,5])
    -ax.grid(True)
    -ax.set_xlabel('z')
    -ax.set_title('step function')
    -
    -plt.show()
    -
    -"""Sine Function"""
    -z = numpy.arange(-2*mt.pi, 2*mt.pi, 0.1)
    -t = numpy.sin(z)
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -ax.plot(z, t)
    -ax.set_ylim([-1.0, 1.0])
    -ax.set_xlim([-2*mt.pi,2*mt.pi])
    -ax.grid(True)
    -ax.set_xlabel('z')
    -ax.set_title('sine function')
    -
    -plt.show()
    -
    -"""Plots a graph of the squashing function used by a rectified linear
    -unit"""
    -z = numpy.arange(-2, 2, .1)
    -zero = numpy.zeros(len(z))
    -y = numpy.max([zero, z], axis=0)
    -
    -fig = plt.figure()
    -ax = fig.add_subplot(111)
    -ax.plot(z, y)
    -ax.set_ylim([-2.0, 2.0])
    -ax.set_xlim([-2.0, 2.0])
    -ax.grid(True)
    -ax.set_xlabel('z')
    -ax.set_title('Rectified linear unit')
    -
    -plt.show()
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    +

    and the hyperbolic tangent function

    +$$ + f(x) = \tanh(x) +$$

    @@ -439,7 +364,7 @@ plt.show()

  • 65
  • 66
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs057.html b/doc/pub/week40/html/._week40-bs057.html index eca12bfb1..e3dedf15b 100644 --- a/doc/pub/week40/html/._week40-bs057.html +++ b/doc/pub/week40/html/._week40-bs057.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,38 +316,108 @@ MathJax.Hub.Config({

     

     

     

    -

    The multilayer perceptron (MLP)

    +

    Relevance

    -

    The multilayer perceptron is a very popular, and easy to implement approach, to deep learning. It consists of

    -
      -
    1. A neural network with one or more layers of nodes between the input and the output nodes.
    2. -
    3. The multilayer network structure, or architecture, or topology, consists of an input layer, one or more hidden layers, and one output layer.
    4. -
    5. The input nodes pass values to the first hidden layer, its nodes pass the information on to the second and so on till we reach the output layer.
    6. -
    -

    As a convention it is normal to call a network with one layer of input units, one layer of hidden -units and one layer of output units as a two-layer network. A network with two layers of hidden units is called a three-layer network etc etc. +

    The sigmoid function are more biologically plausible because the +output of inactive neurons are zero. Such activation function are +called one-sided. However, it has been shown that the hyperbolic +tangent performs better than the sigmoid for training MLPs. has +become the most popular for deep neural networks

    -

    For an MLP network there is no direct connection between the output nodes/neurons/units and the input nodes/neurons/units. -Hereafter we will call the various entities of a layer for nodes. -There are also no connections within a single layer. -

    -

    The number of input nodes does not need to equal the number of output -nodes. This applies also to the hidden layers. Each layer may have its -own number of nodes and activation functions. -

    + +
    +
    +
    +
    +
    +
    """The sigmoid function (or the logistic curve) is a 
    +function that takes any real number, z, and outputs a number (0,1).
    +It is useful in neural networks for assigning weights on a relative scale.
    +The value z is the weighted sum of parameters involved in the learning algorithm."""
    +
    +import numpy
    +import matplotlib.pyplot as plt
    +import math as mt
    +
    +z = numpy.arange(-5, 5, .1)
    +sigma_fn = numpy.vectorize(lambda z: 1/(1+numpy.exp(-z)))
    +sigma = sigma_fn(z)
    +
    +fig = plt.figure()
    +ax = fig.add_subplot(111)
    +ax.plot(z, sigma)
    +ax.set_ylim([-0.1, 1.1])
    +ax.set_xlim([-5,5])
    +ax.grid(True)
    +ax.set_xlabel('z')
    +ax.set_title('sigmoid function')
    +
    +plt.show()
    +
    +"""Step Function"""
    +z = numpy.arange(-5, 5, .02)
    +step_fn = numpy.vectorize(lambda z: 1.0 if z >= 0.0 else 0.0)
    +step = step_fn(z)
    +
    +fig = plt.figure()
    +ax = fig.add_subplot(111)
    +ax.plot(z, step)
    +ax.set_ylim([-0.5, 1.5])
    +ax.set_xlim([-5,5])
    +ax.grid(True)
    +ax.set_xlabel('z')
    +ax.set_title('step function')
    +
    +plt.show()
    +
    +"""Sine Function"""
    +z = numpy.arange(-2*mt.pi, 2*mt.pi, 0.1)
    +t = numpy.sin(z)
    +
    +fig = plt.figure()
    +ax = fig.add_subplot(111)
    +ax.plot(z, t)
    +ax.set_ylim([-1.0, 1.0])
    +ax.set_xlim([-2*mt.pi,2*mt.pi])
    +ax.grid(True)
    +ax.set_xlabel('z')
    +ax.set_title('sine function')
    +
    +plt.show()
    +
    +"""Plots a graph of the squashing function used by a rectified linear
    +unit"""
    +z = numpy.arange(-2, 2, .1)
    +zero = numpy.zeros(len(z))
    +y = numpy.max([zero, z], axis=0)
    +
    +fig = plt.figure()
    +ax = fig.add_subplot(111)
    +ax.plot(z, y)
    +ax.set_ylim([-2.0, 2.0])
    +ax.set_xlim([-2.0, 2.0])
    +ax.grid(True)
    +ax.set_xlabel('z')
    +ax.set_title('Rectified linear unit')
    +
    +plt.show()
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    -

    The hidden layers have their name from the fact that they are not -linked to observables and as we will see below when we define the -so-called activation \( \hat{z} \), we can think of this as a basis -expansion of the original inputs \( \hat{x} \). The difference however -between neural networks and say linear regression is that now these -basis functions (which will correspond to the weights in the network) -are learned from data. This results in an important difference between -neural networks and deep learning approaches on one side and methods -like logistic regression or linear regression and their modifications on the other side. -

    @@ -369,7 +444,7 @@ like logistic regression or linear regression and their modifications on the oth

  • 66
  • 67
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs058.html b/doc/pub/week40/html/._week40-bs058.html index 0124fcaed..23a44609b 100644 --- a/doc/pub/week40/html/._week40-bs058.html +++ b/doc/pub/week40/html/._week40-bs058.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,29 +316,37 @@ MathJax.Hub.Config({

     

     

     

    -

    From one to many layers, the universal approximation theorem

    +

    The multilayer perceptron (MLP)

    -

    A neural network with only one layer, what we called the simple -perceptron, is best suited if we have a standard binary model with -clear (linear) boundaries between the outcomes. As such it could -equally well be replaced by standard linear regression or logistic -regression. Networks with one or more hidden layers approximate -systems with more complex boundaries. +

    The multilayer perceptron is a very popular, and easy to implement approach, to deep learning. It consists of

    +
      +
    1. A neural network with one or more layers of nodes between the input and the output nodes.
    2. +
    3. The multilayer network structure, or architecture, or topology, consists of an input layer, one or more hidden layers, and one output layer.
    4. +
    5. The input nodes pass values to the first hidden layer, its nodes pass the information on to the second and so on till we reach the output layer.
    6. +
    +

    As a convention it is normal to call a network with one layer of input units, one layer of hidden +units and one layer of output units as a two-layer network. A network with two layers of hidden units is called a three-layer network etc etc.

    -

    As stated earlier, -an important theorem in studies of neural networks, restated without -proof here, is the universal approximation -theorem. +

    For an MLP network there is no direct connection between the output nodes/neurons/units and the input nodes/neurons/units. +Hereafter we will call the various entities of a layer for nodes. +There are also no connections within a single layer.

    -

    It states that a feed-forward network with a single hidden layer -containing a finite number of neurons can approximate continuous -functions on compact subsets of real functions. The theorem thus -states that simple neural networks can represent a wide variety of -interesting functions when given appropriate parameters. It is the -multilayer feedforward architecture itself which gives neural networks -the potential of being universal approximators. +

    The number of input nodes does not need to equal the number of output +nodes. This applies also to the hidden layers. Each layer may have its +own number of nodes and activation functions. +

    + +

    The hidden layers have their name from the fact that they are not +linked to observables and as we will see below when we define the +so-called activation \( \hat{z} \), we can think of this as a basis +expansion of the original inputs \( \hat{x} \). The difference however +between neural networks and say linear regression is that now these +basis functions (which will correspond to the weights in the network) +are learned from data. This results in an important difference between +neural networks and deep learning approaches on one side and methods +like logistic regression or linear regression and their modifications on the other side.

    @@ -360,6 +373,8 @@ the potential of being universal approximators.

  • 66
  • 67
  • 68
  • +
  • ...
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs059.html b/doc/pub/week40/html/._week40-bs059.html index 9620aca6d..2c45574bf 100644 --- a/doc/pub/week40/html/._week40-bs059.html +++ b/doc/pub/week40/html/._week40-bs059.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,32 +316,29 @@ MathJax.Hub.Config({

     

     

     

    -

    Deriving the back propagation code for a multilayer perceptron model

    +

    From one to many layers, the universal approximation theorem

    -

    As we have seen now in a feed forward network, we can express the final output of our network in terms of basic matrix-vector multiplications. -The unknowwn quantities are our weights \( w_{ij} \) and we need to find an algorithm for changing them so that our errors are as small as possible. -This leads us to the famous back propagation algorithm. +

    A neural network with only one layer, what we called the simple +perceptron, is best suited if we have a standard binary model with +clear (linear) boundaries between the outcomes. As such it could +equally well be replaced by standard linear regression or logistic +regression. Networks with one or more hidden layers approximate +systems with more complex boundaries.

    -

    The questions we want to ask are how do changes in the biases and the -weights in our network change the cost function and how can we use the -final output to modify the weights? +

    As stated earlier, +an important theorem in studies of neural networks, restated without +proof here, is the universal approximation +theorem.

    -

    To derive these equations let us start with a plain regression problem -and define our cost function as -

    - -$$ -{\cal C}(\hat{W}) = \frac{1}{2}\sum_{i=1}^n\left(y_i - t_i\right)^2, -$$ - -

    where the $t_i$s are our \( n \) targets (the values we want to -reproduce), while the outputs of the network after having propagated -all inputs \( \hat{x} \) are given by \( y_i \). Below we will demonstrate -how the basic equations arising from the back propagation algorithm -can be modified in order to study classification problems with \( K \) -classes. +

    It states that a feed-forward network with a single hidden layer +containing a finite number of neurons can approximate continuous +functions on compact subsets of real functions. The theorem thus +states that simple neural networks can represent a wide variety of +interesting functions when given appropriate parameters. It is the +multilayer feedforward architecture itself which gives neural networks +the potential of being universal approximators.

    @@ -362,6 +364,7 @@ classes.

  • 66
  • 67
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs060.html b/doc/pub/week40/html/._week40-bs060.html index e37efb1b4..8d42a0e6a 100644 --- a/doc/pub/week40/html/._week40-bs060.html +++ b/doc/pub/week40/html/._week40-bs060.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,42 +316,34 @@ MathJax.Hub.Config({

     

     

     

    -

    Definitions

    +

    Deriving the back propagation code for a multilayer perceptron model

    -

    With our definition of the targets \( \hat{t} \), the outputs of the -network \( \hat{y} \) and the inputs \( \hat{x} \) we -define now the activation \( z_j^l \) of node/neuron/unit \( j \) of the -\( l \)-th layer as a function of the bias, the weights which add up from -the previous layer \( l-1 \) and the forward passes/outputs -\( \hat{a}^{l-1} \) from the previous layer as +

    As we have seen now in a feed forward network, we can express the final output of our network in terms of basic matrix-vector multiplications. +The unknowwn quantities are our weights \( w_{ij} \) and we need to find an algorithm for changing them so that our errors are as small as possible. +This leads us to the famous back propagation algorithm. +

    + +

    The questions we want to ask are how do changes in the biases and the +weights in our network change the cost function and how can we use the +final output to modify the weights? +

    + +

    To derive these equations let us start with a plain regression problem +and define our cost function as

    $$ -z_j^l = \sum_{i=1}^{M_{l-1}}w_{ij}^la_i^{l-1}+b_j^l, +{\cal C}(\hat{W}) = \frac{1}{2}\sum_{i=1}^n\left(y_i - t_i\right)^2, $$ -

    where \( b_k^l \) are the biases from layer \( l \). Here \( M_{l-1} \) -represents the total number of nodes/neurons/units of layer \( l-1 \). The -figure here illustrates this equation. We can rewrite this in a more -compact form as the matrix-vector products we discussed earlier, +

    where the $t_i$s are our \( n \) targets (the values we want to +reproduce), while the outputs of the network after having propagated +all inputs \( \hat{x} \) are given by \( y_i \). Below we will demonstrate +how the basic equations arising from the back propagation algorithm +can be modified in order to study classification problems with \( K \) +classes.

    -$$ -\hat{z}^l = \left(\hat{W}^l\right)^T\hat{a}^{l-1}+\hat{b}^l. -$$ - -

    With the activation values \( \hat{z}^l \) we can in turn define the -output of layer \( l \) as \( \hat{a}^l = f(\hat{z}^l) \) where \( f \) is our -activation function. In the examples here we will use the sigmoid -function discussed in our logistic regression lectures. We will also use the same activation function \( f \) for all layers -and their nodes. It means we have -

    - -$$ -a_j^l = f(z_j^l) = \frac{1}{1+\exp{-(z_j^l)}}. -$$ - -

    diff --git a/doc/pub/week40/html/._week40-bs061.html b/doc/pub/week40/html/._week40-bs061.html index 1cbcf0485..ae00022a1 100644 --- a/doc/pub/week40/html/._week40-bs061.html +++ b/doc/pub/week40/html/._week40-bs061.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,21 +316,39 @@ MathJax.Hub.Config({

     

     

     

    -

    Derivatives and the chain rule

    +

    Definitions

    + +

    With our definition of the targets \( \hat{t} \), the outputs of the +network \( \hat{y} \) and the inputs \( \hat{x} \) we +define now the activation \( z_j^l \) of node/neuron/unit \( j \) of the +\( l \)-th layer as a function of the bias, the weights which add up from +the previous layer \( l-1 \) and the forward passes/outputs +\( \hat{a}^{l-1} \) from the previous layer as +

    -

    From the definition of the activation \( z_j^l \) we have

    $$ -\frac{\partial z_j^l}{\partial w_{ij}^l} = a_i^{l-1}, +z_j^l = \sum_{i=1}^{M_{l-1}}w_{ij}^la_i^{l-1}+b_j^l, $$ -

    and

    +

    where \( b_k^l \) are the biases from layer \( l \). Here \( M_{l-1} \) +represents the total number of nodes/neurons/units of layer \( l-1 \). The +figure here illustrates this equation. We can rewrite this in a more +compact form as the matrix-vector products we discussed earlier, +

    + $$ -\frac{\partial z_j^l}{\partial a_i^{l-1}} = w_{ji}^l. +\hat{z}^l = \left(\hat{W}^l\right)^T\hat{a}^{l-1}+\hat{b}^l. $$ -

    With our definition of the activation function we have that (note that this function depends only on \( z_j^l \))

    +

    With the activation values \( \hat{z}^l \) we can in turn define the +output of layer \( l \) as \( \hat{a}^l = f(\hat{z}^l) \) where \( f \) is our +activation function. In the examples here we will use the sigmoid +function discussed in our logistic regression lectures. We will also use the same activation function \( f \) for all layers +and their nodes. It means we have +

    + $$ -\frac{\partial a_j^l}{\partial z_j^{l}} = a_j^l(1-a_j^l)=f(z_j^l)(1-f(z_j^l)). +a_j^l = f(z_j^l) = \frac{1}{1+\exp{-(z_j^l)}}. $$ @@ -350,6 +373,7 @@ $$
  • 66
  • 67
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs062.html b/doc/pub/week40/html/._week40-bs062.html index cb04a5cdd..bbefd0b39 100644 --- a/doc/pub/week40/html/._week40-bs062.html +++ b/doc/pub/week40/html/._week40-bs062.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,24 +316,21 @@ MathJax.Hub.Config({

     

     

     

    -

    Derivative of the cost function

    +

    Derivatives and the chain rule

    -

    With these definitions we can now compute the derivative of the cost function in terms of the weights.

    - -

    Let us specialize to the output layer \( l=L \). Our cost function is

    +

    From the definition of the activation \( z_j^l \) we have

    $$ -{\cal C}(\hat{W^L}) = \frac{1}{2}\sum_{i=1}^n\left(y_i - t_i\right)^2=\frac{1}{2}\sum_{i=1}^n\left(a_i^L - t_i\right)^2, +\frac{\partial z_j^l}{\partial w_{ij}^l} = a_i^{l-1}, $$ -

    The derivative of this function with respect to the weights is

    - +

    and

    $$ -\frac{\partial{\cal C}(\hat{W^L})}{\partial w_{jk}^L} = \left(a_j^L - t_j\right)\frac{\partial a_j^L}{\partial w_{jk}^{L}}, +\frac{\partial z_j^l}{\partial a_i^{l-1}} = w_{ji}^l. $$ -

    The last partial derivative can easily be computed and reads (by applying the chain rule)

    +

    With our definition of the activation function we have that (note that this function depends only on \( z_j^l \))

    $$ -\frac{\partial a_j^L}{\partial w_{jk}^{L}} = \frac{\partial a_j^L}{\partial z_{j}^{L}}\frac{\partial z_j^L}{\partial w_{jk}^{L}}=a_j^L(1-a_j^L)a_k^{L-1}, +\frac{\partial a_j^l}{\partial z_j^{l}} = a_j^l(1-a_j^l)=f(z_j^l)(1-f(z_j^l)). $$ @@ -352,6 +354,7 @@ $$
  • 66
  • 67
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs063.html b/doc/pub/week40/html/._week40-bs063.html index b5972e360..085c1483a 100644 --- a/doc/pub/week40/html/._week40-bs063.html +++ b/doc/pub/week40/html/._week40-bs063.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,48 +316,24 @@ MathJax.Hub.Config({

     

     

     

    -

    Bringing it together, first back propagation equation

    +

    Derivative of the cost function

    -

    We have thus

    +

    With these definitions we can now compute the derivative of the cost function in terms of the weights.

    + +

    Let us specialize to the output layer \( l=L \). Our cost function is

    $$ -\frac{\partial{\cal C}(\hat{W^L})}{\partial w_{jk}^L} = \left(a_j^L - t_j\right)a_j^L(1-a_j^L)a_k^{L-1}, +{\cal C}(\hat{W^L}) = \frac{1}{2}\sum_{i=1}^n\left(y_i - t_i\right)^2=\frac{1}{2}\sum_{i=1}^n\left(a_i^L - t_i\right)^2, $$ -

    Defining

    -$$ -\delta_j^L = a_j^L(1-a_j^L)\left(a_j^L - t_j\right) = f'(z_j^L)\frac{\partial {\cal C}}{\partial (a_j^L)}, -$$ - -

    and using the Hadamard product of two vectors we can write this as

    -$$ -\hat{\delta}^L = f'(\hat{z}^L)\circ\frac{\partial {\cal C}}{\partial (\hat{a}^L)}. -$$ - -

    This is an important expression. The second term on the right handside -measures how fast the cost function is changing as a function of the $j$th -output activation. If, for example, the cost function doesn't depend -much on a particular output node \( j \), then \( \delta_j^L \) will be small, -which is what we would expect. The first term on the right, measures -how fast the activation function \( f \) is changing at a given activation -value \( z_j^L \). -

    - -

    Notice that everything in the above equations is easily computed. In -particular, we compute \( z_j^L \) while computing the behaviour of the -network, and it is only a small additional overhead to compute -\( f'(z^L_j) \). The exact form of the derivative with respect to the -output depends on the form of the cost function. -However, provided the cost function is known there should be little -trouble in calculating -

    +

    The derivative of this function with respect to the weights is

    $$ -\frac{\partial {\cal C}}{\partial (a_j^L)} +\frac{\partial{\cal C}(\hat{W^L})}{\partial w_{jk}^L} = \left(a_j^L - t_j\right)\frac{\partial a_j^L}{\partial w_{jk}^{L}}, $$ -

    With the definition of \( \delta_j^L \) we have a more compact definition of the derivative of the cost function in terms of the weights, namely

    +

    The last partial derivative can easily be computed and reads (by applying the chain rule)

    $$ -\frac{\partial{\cal C}(\hat{W^L})}{\partial w_{jk}^L} = \delta_j^La_k^{L-1}. +\frac{\partial a_j^L}{\partial w_{jk}^{L}} = \frac{\partial a_j^L}{\partial z_{j}^{L}}\frac{\partial z_j^L}{\partial w_{jk}^{L}}=a_j^L(1-a_j^L)a_k^{L-1}, $$ @@ -375,6 +356,7 @@ $$
  • 66
  • 67
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/._week40-bs064.html b/doc/pub/week40/html/._week40-bs064.html index 1200d838b..46316cd9c 100644 --- a/doc/pub/week40/html/._week40-bs064.html +++ b/doc/pub/week40/html/._week40-bs064.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,20 +316,51 @@ MathJax.Hub.Config({

     

     

     

    -

    Derivatives in terms of \( z_j^L \)

    - -

    It is also easy to see that our previous equation can be written as

    +

    Bringing it together, first back propagation equation

    +

    We have thus

    $$ -\delta_j^L =\frac{\partial {\cal C}}{\partial z_j^L}= \frac{\partial {\cal C}}{\partial a_j^L}\frac{\partial a_j^L}{\partial z_j^L}, +\frac{\partial{\cal C}(\hat{W^L})}{\partial w_{jk}^L} = \left(a_j^L - t_j\right)a_j^L(1-a_j^L)a_k^{L-1}, $$ -

    which can also be interpreted as the partial derivative of the cost function with respect to the biases \( b_j^L \), namely

    +

    Defining

    $$ -\delta_j^L = \frac{\partial {\cal C}}{\partial b_j^L}\frac{\partial b_j^L}{\partial z_j^L}=\frac{\partial {\cal C}}{\partial b_j^L}, +\delta_j^L = a_j^L(1-a_j^L)\left(a_j^L - t_j\right) = f'(z_j^L)\frac{\partial {\cal C}}{\partial (a_j^L)}, $$ -

    That is, the error \( \delta_j^L \) is exactly equal to the rate of change of the cost function as a function of the bias.

    +

    and using the Hadamard product of two vectors we can write this as

    +$$ +\hat{\delta}^L = f'(\hat{z}^L)\circ\frac{\partial {\cal C}}{\partial (\hat{a}^L)}. +$$ + +

    This is an important expression. The second term on the right handside +measures how fast the cost function is changing as a function of the $j$th +output activation. If, for example, the cost function doesn't depend +much on a particular output node \( j \), then \( \delta_j^L \) will be small, +which is what we would expect. The first term on the right, measures +how fast the activation function \( f \) is changing at a given activation +value \( z_j^L \). +

    + +

    Notice that everything in the above equations is easily computed. In +particular, we compute \( z_j^L \) while computing the behaviour of the +network, and it is only a small additional overhead to compute +\( f'(z^L_j) \). The exact form of the derivative with respect to the +output depends on the form of the cost function. +However, provided the cost function is known there should be little +trouble in calculating +

    + +$$ +\frac{\partial {\cal C}}{\partial (a_j^L)} +$$ + +

    With the definition of \( \delta_j^L \) we have a more compact definition of the derivative of the cost function in terms of the weights, namely

    +$$ +\frac{\partial{\cal C}(\hat{W^L})}{\partial w_{jk}^L} = \delta_j^La_k^{L-1}. +$$ + +

    diff --git a/doc/pub/week40/html/._week40-bs065.html b/doc/pub/week40/html/._week40-bs065.html index 5e22e42c8..ab86d88a5 100644 --- a/doc/pub/week40/html/._week40-bs065.html +++ b/doc/pub/week40/html/._week40-bs065.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -311,63 +316,20 @@ MathJax.Hub.Config({

     

     

     

    -

    Bringing it together

    +

    Derivatives in terms of \( z_j^L \)

    -

    We have now three equations that are essential for the computations of the derivatives of the cost function at the output layer. These equations are needed to start the algorithm and they are

    - -
    -
    - +

    It is also easy to see that our previous equation can be written as

    $$ -\begin{equation} -\frac{\partial{\cal C}(\hat{W^L})}{\partial w_{jk}^L} = \delta_j^La_k^{L-1}, -\tag{18} -\end{equation} +\delta_j^L =\frac{\partial {\cal C}}{\partial z_j^L}= \frac{\partial {\cal C}}{\partial a_j^L}\frac{\partial a_j^L}{\partial z_j^L}, $$ -

    and

    +

    which can also be interpreted as the partial derivative of the cost function with respect to the biases \( b_j^L \), namely

    $$ -\begin{equation} -\delta_j^L = f'(z_j^L)\frac{\partial {\cal C}}{\partial (a_j^L)}, -\tag{19} -\end{equation} +\delta_j^L = \frac{\partial {\cal C}}{\partial b_j^L}\frac{\partial b_j^L}{\partial z_j^L}=\frac{\partial {\cal C}}{\partial b_j^L}, $$ -

    and

    - -$$ -\begin{equation} -\delta_j^L = \frac{\partial {\cal C}}{\partial b_j^L}, -\tag{20} -\end{equation} -$$ -
    -
    - - -

    An interesting consequence of the above equations is that when the -activation \( a_k^{L-1} \) is small, the gradient term, that is the -derivative of the cost function with respect to the weights, will also -tend to be small. We say then that the weight learns slowly, meaning -that it changes slowly when we minimize the weights via say gradient -descent. In this case we say the system learns slowly. -

    - -

    Another interesting feature is that is when the activation function, -represented by the sigmoid function here, is rather flat when we move towards -its end values \( 0 \) and \( 1 \) (see the above Python codes). In these -cases, the derivatives of the activation function will also be close -to zero, meaning again that the gradients will be small and the -network learns slowly again. -

    - -

    We need a fourth equation and we are set. We are going to propagate -backwards in order to the determine the weights and biases. In order -to do so we need to represent the error in the layer before the final -one \( L-1 \) in terms of the errors in the final output layer. -

    - +

    That is, the error \( \delta_j^L \) is exactly equal to the rate of change of the cost function as a function of the bias.

      @@ -385,6 +347,7 @@ one \( L-1 \) in terms of the errors in the final output layer.
    • 66
    • 67
    • 68
    • +
    • 69
    • »
    diff --git a/doc/pub/week40/html/week40-bs.html b/doc/pub/week40/html/week40-bs.html index e8a92879b..79fcc3f5f 100644 --- a/doc/pub/week40/html/week40-bs.html +++ b/doc/pub/week40/html/week40-bs.html @@ -104,6 +104,10 @@ doconce format html week40.do.txt --html_style=bootstrap --pygments_html_style=d 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -264,42 +268,43 @@ MathJax.Hub.Config({
  • The syntax a.dot(b) when finding the dot product
  • Recommended to avoid
  • Using Autograd with OLS
  • -
  • And Logistic Regression
  • -
  • Videos on Neural Networks
  • -
  • Neural networks
  • -
  • Artificial neurons
  • -
  • Neural network types
  • -
  • Feed-forward neural networks
  • -
  • Convolutional Neural Network
  • -
  • Recurrent neural networks
  • -
  • Other types of networks
  • -
  • Multilayer perceptrons
  • -
  • Why multilayer perceptrons?
  • -
  • Illustration of a single perceptropn model and a multi-perceptron model
  • -
  • Examples of XOR, OR and AND gates
  • -
  • Does Logistic Regression do a better Job?
  • -
  • Adding Neural Networks
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  • Mathematical model
  • -
  •    Matrix-vector notation
  • -
  •    Matrix-vector notation and activation
  • -
  •    Activation functions
  • -
  •    Activation functions, Logistic and Hyperbolic ones
  • -
  •    Relevance
  • -
  • The multilayer perceptron (MLP)
  • -
  • From one to many layers, the universal approximation theorem
  • -
  • Deriving the back propagation code for a multilayer perceptron model
  • -
  • Definitions
  • -
  • Derivatives and the chain rule
  • -
  • Derivative of the cost function
  • -
  • Bringing it together, first back propagation equation
  • -
  • Derivatives in terms of \( z_j^L \)
  • -
  • Bringing it together
  • -
  • Final back propagating equation
  • -
  • Setting up the Back propagation algorithm
  • +
  • Including Stochastic Gradient Descent with Autograd
  • +
  • And Logistic Regression
  • +
  • Videos on Neural Networks
  • +
  • Neural networks
  • +
  • Artificial neurons
  • +
  • Neural network types
  • +
  • Feed-forward neural networks
  • +
  • Convolutional Neural Network
  • +
  • Recurrent neural networks
  • +
  • Other types of networks
  • +
  • Multilayer perceptrons
  • +
  • Why multilayer perceptrons?
  • +
  • Illustration of a single perceptropn model and a multi-perceptron model
  • +
  • Examples of XOR, OR and AND gates
  • +
  • Does Logistic Regression do a better Job?
  • +
  • Adding Neural Networks
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  • Mathematical model
  • +
  •    Matrix-vector notation
  • +
  •    Matrix-vector notation and activation
  • +
  •    Activation functions
  • +
  •    Activation functions, Logistic and Hyperbolic ones
  • +
  •    Relevance
  • +
  • The multilayer perceptron (MLP)
  • +
  • From one to many layers, the universal approximation theorem
  • +
  • Deriving the back propagation code for a multilayer perceptron model
  • +
  • Definitions
  • +
  • Derivatives and the chain rule
  • +
  • Derivative of the cost function
  • +
  • Bringing it together, first back propagation equation
  • +
  • Derivatives in terms of \( z_j^L \)
  • +
  • Bringing it together
  • +
  • Final back propagating equation
  • +
  • Setting up the Back propagation algorithm
  • @@ -354,7 +359,7 @@ MathJax.Hub.Config({
  • 9
  • 10
  • ...
  • -
  • 68
  • +
  • 69
  • »
  • diff --git a/doc/pub/week40/html/week40-reveal.html b/doc/pub/week40/html/week40-reveal.html index 362eee06d..89a271df5 100644 --- a/doc/pub/week40/html/week40-reveal.html +++ b/doc/pub/week40/html/week40-reveal.html @@ -1557,6 +1557,106 @@ plt.show() +
    +

    Including Stochastic Gradient Descent with Autograd

    +

    In this code we include the stochastic gradient descent approach discussed above. Note here that we specify which argument we are taking the derivative with respect to when using autograd.

    + + + +
    +
    +
    +
    +
    +
    # Using Autograd to calculate gradients using SGD
    +# OLS example
    +from random import random, seed
    +import numpy as np
    +import autograd.numpy as np
    +import matplotlib.pyplot as plt
    +from autograd import grad
    +
    +# Note change from previous example
    +def CostOLS(y,X,theta):
    +    return np.sum((y-X @ theta)**2)
    +
    +n = 100
    +x = 2*np.random.rand(n,1)
    +y = 4+3*x+np.random.randn(n,1)
    +
    +X = np.c_[np.ones((n,1)), x]
    +XT_X = X.T @ X
    +theta_linreg = np.linalg.pinv(XT_X) @ (X.T @ y)
    +print("Own inversion")
    +print(theta_linreg)
    +# Hessian matrix
    +H = (2.0/n)* XT_X
    +EigValues, EigVectors = np.linalg.eig(H)
    +print(f"Eigenvalues of Hessian Matrix:{EigValues}")
    +
    +theta = np.random.randn(2,1)
    +eta = 1.0/np.max(EigValues)
    +Niterations = 1000
    +
    +# Note that we request the derivative wrt third argument (theta, 2 here)
    +training_gradient = grad(CostOLS,2)
    +
    +for iter in range(Niterations):
    +    gradients = (1.0/n)*training_gradient(y, X, theta)
    +    theta -= eta*gradients
    +print("theta from own gd")
    +print(theta)
    +
    +xnew = np.array([[0],[2]])
    +Xnew = np.c_[np.ones((2,1)), xnew]
    +ypredict = Xnew.dot(theta)
    +ypredict2 = Xnew.dot(theta_linreg)
    +
    +plt.plot(xnew, ypredict, "r-")
    +plt.plot(xnew, ypredict2, "b-")
    +plt.plot(x, y ,'ro')
    +plt.axis([0,2.0,0, 15.0])
    +plt.xlabel(r'$x$')
    +plt.ylabel(r'$y$')
    +plt.title(r'Random numbers ')
    +plt.show()
    +
    +n_epochs = 50
    +M = 5   #size of each minibatch
    +m = int(n/M) #number of minibatches
    +t0, t1 = 5, 50
    +def learning_schedule(t):
    +    return t0/(t+t1)
    +
    +theta = np.random.randn(2,1)
    +
    +for epoch in range(n_epochs):
    +# Can you figure out a better way of setting up the contributions to each batch?
    +    for i in range(m):
    +        random_index = np.random.randint(m)
    +        xi = X[random_index*M:random_index*M+M]
    +        yi = y[random_index*M:random_index*M+M]
    +        gradients = (2.0/M)*training_gradient(yi, xi, theta)
    +        eta = learning_schedule(epoch*m+i)
    +        theta = theta - eta*gradients
    +print("theta from own sdg")
    +print(theta)
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    And Logistic Regression

    diff --git a/doc/pub/week40/html/week40-solarized.html b/doc/pub/week40/html/week40-solarized.html index 7e061ee66..eab5aa203 100644 --- a/doc/pub/week40/html/week40-solarized.html +++ b/doc/pub/week40/html/week40-solarized.html @@ -131,6 +131,10 @@ div.toc p,a { 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -1571,6 +1575,106 @@ plt.show() +









    +

    Including Stochastic Gradient Descent with Autograd

    +

    In this code we include the stochastic gradient descent approach discussed above. Note here that we specify which argument we are taking the derivative with respect to when using autograd.

    + + + +
    +
    +
    +
    +
    +
    # Using Autograd to calculate gradients using SGD
    +# OLS example
    +from random import random, seed
    +import numpy as np
    +import autograd.numpy as np
    +import matplotlib.pyplot as plt
    +from autograd import grad
    +
    +# Note change from previous example
    +def CostOLS(y,X,theta):
    +    return np.sum((y-X @ theta)**2)
    +
    +n = 100
    +x = 2*np.random.rand(n,1)
    +y = 4+3*x+np.random.randn(n,1)
    +
    +X = np.c_[np.ones((n,1)), x]
    +XT_X = X.T @ X
    +theta_linreg = np.linalg.pinv(XT_X) @ (X.T @ y)
    +print("Own inversion")
    +print(theta_linreg)
    +# Hessian matrix
    +H = (2.0/n)* XT_X
    +EigValues, EigVectors = np.linalg.eig(H)
    +print(f"Eigenvalues of Hessian Matrix:{EigValues}")
    +
    +theta = np.random.randn(2,1)
    +eta = 1.0/np.max(EigValues)
    +Niterations = 1000
    +
    +# Note that we request the derivative wrt third argument (theta, 2 here)
    +training_gradient = grad(CostOLS,2)
    +
    +for iter in range(Niterations):
    +    gradients = (1.0/n)*training_gradient(y, X, theta)
    +    theta -= eta*gradients
    +print("theta from own gd")
    +print(theta)
    +
    +xnew = np.array([[0],[2]])
    +Xnew = np.c_[np.ones((2,1)), xnew]
    +ypredict = Xnew.dot(theta)
    +ypredict2 = Xnew.dot(theta_linreg)
    +
    +plt.plot(xnew, ypredict, "r-")
    +plt.plot(xnew, ypredict2, "b-")
    +plt.plot(x, y ,'ro')
    +plt.axis([0,2.0,0, 15.0])
    +plt.xlabel(r'$x$')
    +plt.ylabel(r'$y$')
    +plt.title(r'Random numbers ')
    +plt.show()
    +
    +n_epochs = 50
    +M = 5   #size of each minibatch
    +m = int(n/M) #number of minibatches
    +t0, t1 = 5, 50
    +def learning_schedule(t):
    +    return t0/(t+t1)
    +
    +theta = np.random.randn(2,1)
    +
    +for epoch in range(n_epochs):
    +# Can you figure out a better way of setting up the contributions to each batch?
    +    for i in range(m):
    +        random_index = np.random.randint(m)
    +        xi = X[random_index*M:random_index*M+M]
    +        yi = y[random_index*M:random_index*M+M]
    +        gradients = (2.0/M)*training_gradient(yi, xi, theta)
    +        eta = learning_schedule(epoch*m+i)
    +        theta = theta - eta*gradients
    +print("theta from own sdg")
    +print(theta)
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +









    And Logistic Regression

    diff --git a/doc/pub/week40/html/week40.html b/doc/pub/week40/html/week40.html index 7bbdf177f..1e6243108 100644 --- a/doc/pub/week40/html/week40.html +++ b/doc/pub/week40/html/week40.html @@ -208,6 +208,10 @@ div.toc p,a { 'the-syntax-a-dot-b-when-finding-the-dot-product'), ('Recommended to avoid', 2, None, 'recommended-to-avoid'), ('Using Autograd with OLS', 2, None, 'using-autograd-with-ols'), + ('Including Stochastic Gradient Descent with Autograd', + 2, + None, + 'including-stochastic-gradient-descent-with-autograd'), ('And Logistic Regression', 2, None, 'and-logistic-regression'), ('Videos on Neural Networks', 2, @@ -1648,6 +1652,106 @@ plt.show() +









    +

    Including Stochastic Gradient Descent with Autograd

    +

    In this code we include the stochastic gradient descent approach discussed above. Note here that we specify which argument we are taking the derivative with respect to when using autograd.

    + + + +
    +
    +
    +
    +
    +
    # Using Autograd to calculate gradients using SGD
    +# OLS example
    +from random import random, seed
    +import numpy as np
    +import autograd.numpy as np
    +import matplotlib.pyplot as plt
    +from autograd import grad
    +
    +# Note change from previous example
    +def CostOLS(y,X,theta):
    +    return np.sum((y-X @ theta)**2)
    +
    +n = 100
    +x = 2*np.random.rand(n,1)
    +y = 4+3*x+np.random.randn(n,1)
    +
    +X = np.c_[np.ones((n,1)), x]
    +XT_X = X.T @ X
    +theta_linreg = np.linalg.pinv(XT_X) @ (X.T @ y)
    +print("Own inversion")
    +print(theta_linreg)
    +# Hessian matrix
    +H = (2.0/n)* XT_X
    +EigValues, EigVectors = np.linalg.eig(H)
    +print(f"Eigenvalues of Hessian Matrix:{EigValues}")
    +
    +theta = np.random.randn(2,1)
    +eta = 1.0/np.max(EigValues)
    +Niterations = 1000
    +
    +# Note that we request the derivative wrt third argument (theta, 2 here)
    +training_gradient = grad(CostOLS,2)
    +
    +for iter in range(Niterations):
    +    gradients = (1.0/n)*training_gradient(y, X, theta)
    +    theta -= eta*gradients
    +print("theta from own gd")
    +print(theta)
    +
    +xnew = np.array([[0],[2]])
    +Xnew = np.c_[np.ones((2,1)), xnew]
    +ypredict = Xnew.dot(theta)
    +ypredict2 = Xnew.dot(theta_linreg)
    +
    +plt.plot(xnew, ypredict, "r-")
    +plt.plot(xnew, ypredict2, "b-")
    +plt.plot(x, y ,'ro')
    +plt.axis([0,2.0,0, 15.0])
    +plt.xlabel(r'$x$')
    +plt.ylabel(r'$y$')
    +plt.title(r'Random numbers ')
    +plt.show()
    +
    +n_epochs = 50
    +M = 5   #size of each minibatch
    +m = int(n/M) #number of minibatches
    +t0, t1 = 5, 50
    +def learning_schedule(t):
    +    return t0/(t+t1)
    +
    +theta = np.random.randn(2,1)
    +
    +for epoch in range(n_epochs):
    +# Can you figure out a better way of setting up the contributions to each batch?
    +    for i in range(m):
    +        random_index = np.random.randint(m)
    +        xi = X[random_index*M:random_index*M+M]
    +        yi = y[random_index*M:random_index*M+M]
    +        gradients = (2.0/M)*training_gradient(yi, xi, theta)
    +        eta = learning_schedule(epoch*m+i)
    +        theta = theta - eta*gradients
    +print("theta from own sdg")
    +print(theta)
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +









    And Logistic Regression

    diff --git a/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz b/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz index 37c811091..4a02258ed 100644 Binary files a/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz and b/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz differ diff --git a/doc/pub/week40/ipynb/week40.ipynb b/doc/pub/week40/ipynb/week40.ipynb index d143cad82..b160c9503 100644 --- a/doc/pub/week40/ipynb/week40.ipynb +++ b/doc/pub/week40/ipynb/week40.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "8786c916", + "id": "2e064e52", "metadata": { "editable": true }, @@ -14,7 +14,7 @@ }, { "cell_type": "markdown", - "id": "165c9c05", + "id": "74a3ac3e", "metadata": { "editable": true }, @@ -29,7 +29,7 @@ }, { "cell_type": "markdown", - "id": "c96febee", + "id": "337b794a", "metadata": { "editable": true }, @@ -51,7 +51,7 @@ }, { "cell_type": "markdown", - "id": "cf8f7405", + "id": "8e6d5b80", "metadata": { "editable": true }, @@ -63,7 +63,7 @@ }, { "cell_type": "markdown", - "id": "b6c7ac52", + "id": "c0aa61eb", "metadata": { "editable": true }, @@ -85,7 +85,7 @@ }, { "cell_type": "markdown", - "id": "28929f23", + "id": "a26c735b", "metadata": { "editable": true }, @@ -117,7 +117,7 @@ }, { "cell_type": "markdown", - "id": "1409024c", + "id": "49c015d0", "metadata": { "editable": true }, @@ -134,7 +134,7 @@ }, { "cell_type": "markdown", - "id": "af0cb674", + "id": "2ffd2cee", "metadata": { "editable": true }, @@ -147,7 +147,7 @@ }, { "cell_type": "markdown", - "id": "b47911c7", + "id": "a0b744d6", "metadata": { "editable": true }, @@ -160,7 +160,7 @@ }, { "cell_type": "markdown", - "id": "f8f90b11", + "id": "0b5f0d51", "metadata": { "editable": true }, @@ -173,7 +173,7 @@ }, { "cell_type": "markdown", - "id": "162b7e1a", + "id": "1aa15c93", "metadata": { "editable": true }, @@ -187,7 +187,7 @@ }, { "cell_type": "markdown", - "id": "56777103", + "id": "5a81f7c7", "metadata": { "editable": true }, @@ -210,7 +210,7 @@ }, { "cell_type": "markdown", - "id": "0ad38e0f", + "id": "c96985f2", "metadata": { "editable": true }, @@ -225,7 +225,7 @@ }, { "cell_type": "markdown", - "id": "7625169c", + "id": "e7e6836b", "metadata": { "editable": true }, @@ -237,7 +237,7 @@ }, { "cell_type": "markdown", - "id": "28b5b247", + "id": "aca06f53", "metadata": { "editable": true }, @@ -250,7 +250,7 @@ }, { "cell_type": "markdown", - "id": "f8bee447", + "id": "1cf73b37", "metadata": { "editable": true }, @@ -264,7 +264,7 @@ }, { "cell_type": "markdown", - "id": "c178bfd4", + "id": "d9aa3662", "metadata": { "editable": true }, @@ -275,7 +275,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "68631e04", + "id": "d979ba35", "metadata": { "collapsed": false, "editable": true @@ -300,7 +300,7 @@ }, { "cell_type": "markdown", - "id": "83d442dd", + "id": "42081dc1", "metadata": { "editable": true }, @@ -316,7 +316,7 @@ }, { "cell_type": "markdown", - "id": "3d2f460d", + "id": "0ac64f4a", "metadata": { "editable": true }, @@ -337,7 +337,7 @@ }, { "cell_type": "markdown", - "id": "6a012a71", + "id": "bc68f86a", "metadata": { "editable": true }, @@ -360,7 +360,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "fac18d3a", + "id": "f8c5407d", "metadata": { "collapsed": false, "editable": true @@ -395,7 +395,7 @@ }, { "cell_type": "markdown", - "id": "8da21c32", + "id": "ea2cf5bb", "metadata": { "editable": true }, @@ -405,7 +405,7 @@ }, { "cell_type": "markdown", - "id": "7ae324c2", + "id": "0f1e90ab", "metadata": { "editable": true }, @@ -416,7 +416,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "ca0a481f", + "id": "9599012b", "metadata": { "collapsed": false, "editable": true @@ -498,7 +498,7 @@ }, { "cell_type": "markdown", - "id": "35fc880f", + "id": "1a445879", "metadata": { "editable": true }, @@ -513,7 +513,7 @@ }, { "cell_type": "markdown", - "id": "e456bd91", + "id": "e50f5198", "metadata": { "editable": true }, @@ -525,7 +525,7 @@ }, { "cell_type": "markdown", - "id": "6d196f2a", + "id": "9b1f5752", "metadata": { "editable": true }, @@ -543,7 +543,7 @@ }, { "cell_type": "markdown", - "id": "e57a6b16", + "id": "55dc76ca", "metadata": { "editable": true }, @@ -562,7 +562,7 @@ }, { "cell_type": "markdown", - "id": "466e9bb1", + "id": "1a922557", "metadata": { "editable": true }, @@ -574,7 +574,7 @@ }, { "cell_type": "markdown", - "id": "5f6f68aa", + "id": "8cda1681", "metadata": { "editable": true }, @@ -584,7 +584,7 @@ }, { "cell_type": "markdown", - "id": "810d53aa", + "id": "1f3f99f4", "metadata": { "editable": true }, @@ -600,7 +600,7 @@ }, { "cell_type": "markdown", - "id": "4b20c9c1", + "id": "f16258e5", "metadata": { "editable": true }, @@ -612,7 +612,7 @@ }, { "cell_type": "markdown", - "id": "8c484d19", + "id": "714e253d", "metadata": { "editable": true }, @@ -622,7 +622,7 @@ }, { "cell_type": "markdown", - "id": "32d0a434", + "id": "ba9c27ca", "metadata": { "editable": true }, @@ -634,7 +634,7 @@ }, { "cell_type": "markdown", - "id": "7fe1955b", + "id": "9ada2b55", "metadata": { "editable": true }, @@ -644,7 +644,7 @@ }, { "cell_type": "markdown", - "id": "13315bd2", + "id": "1dab5b45", "metadata": { "editable": true }, @@ -656,7 +656,7 @@ }, { "cell_type": "markdown", - "id": "3f468de1", + "id": "af0c4c94", "metadata": { "editable": true }, @@ -672,7 +672,7 @@ }, { "cell_type": "markdown", - "id": "63863022", + "id": "a99f4367", "metadata": { "editable": true }, @@ -684,7 +684,7 @@ }, { "cell_type": "markdown", - "id": "5738f727", + "id": "33e67d82", "metadata": { "editable": true }, @@ -717,7 +717,7 @@ }, { "cell_type": "markdown", - "id": "aa51025c", + "id": "8e88cb9c", "metadata": { "editable": true }, @@ -729,7 +729,7 @@ }, { "cell_type": "markdown", - "id": "b555f221", + "id": "85d24114", "metadata": { "editable": true }, @@ -747,7 +747,7 @@ }, { "cell_type": "markdown", - "id": "48e65522", + "id": "96cbc7ad", "metadata": { "editable": true }, @@ -757,7 +757,7 @@ }, { "cell_type": "markdown", - "id": "aa5b8ee7", + "id": "09587ea5", "metadata": { "editable": true }, @@ -788,7 +788,7 @@ }, { "cell_type": "markdown", - "id": "dd5fe4b0", + "id": "a4fab14c", "metadata": { "editable": true }, @@ -803,7 +803,7 @@ }, { "cell_type": "markdown", - "id": "6a8eeb35", + "id": "9d1e9528", "metadata": { "editable": true }, @@ -821,7 +821,7 @@ }, { "cell_type": "markdown", - "id": "7503e18f", + "id": "b983c2e4", "metadata": { "editable": true }, @@ -833,7 +833,7 @@ }, { "cell_type": "markdown", - "id": "096f05e5", + "id": "a83cdb71", "metadata": { "editable": true }, @@ -845,7 +845,7 @@ }, { "cell_type": "markdown", - "id": "0fd79a49", + "id": "87ba5403", "metadata": { "editable": true }, @@ -863,7 +863,7 @@ }, { "cell_type": "markdown", - "id": "e8cb4362", + "id": "34368494", "metadata": { "editable": true }, @@ -886,7 +886,7 @@ }, { "cell_type": "markdown", - "id": "edeed335", + "id": "a52d1737", "metadata": { "editable": true }, @@ -904,7 +904,7 @@ }, { "cell_type": "markdown", - "id": "16bea93e", + "id": "0520dbc3", "metadata": { "editable": true }, @@ -916,7 +916,7 @@ }, { "cell_type": "markdown", - "id": "e69a53e0", + "id": "7e43fae4", "metadata": { "editable": true }, @@ -928,7 +928,7 @@ }, { "cell_type": "markdown", - "id": "206eaba7", + "id": "52dde39c", "metadata": { "editable": true }, @@ -940,7 +940,7 @@ }, { "cell_type": "markdown", - "id": "2acf3871", + "id": "2b5dd7dc", "metadata": { "editable": true }, @@ -952,7 +952,7 @@ }, { "cell_type": "markdown", - "id": "c52ac26c", + "id": "4c8fd34a", "metadata": { "editable": true }, @@ -964,7 +964,7 @@ }, { "cell_type": "markdown", - "id": "b19f8588", + "id": "76f7a92f", "metadata": { "editable": true }, @@ -981,7 +981,7 @@ }, { "cell_type": "markdown", - "id": "e6ecb5ce", + "id": "dda15856", "metadata": { "editable": true }, @@ -1000,7 +1000,7 @@ }, { "cell_type": "markdown", - "id": "312fcceb", + "id": "8aeda58f", "metadata": { "editable": true }, @@ -1012,7 +1012,7 @@ }, { "cell_type": "markdown", - "id": "450b3d36", + "id": "13cad70d", "metadata": { "editable": true }, @@ -1032,7 +1032,7 @@ }, { "cell_type": "markdown", - "id": "96618419", + "id": "419c2c61", "metadata": { "editable": true }, @@ -1070,7 +1070,7 @@ }, { "cell_type": "markdown", - "id": "5c5307e5", + "id": "6ddf2971", "metadata": { "editable": true }, @@ -1082,7 +1082,7 @@ }, { "cell_type": "markdown", - "id": "17618c0d", + "id": "a60c1bc2", "metadata": { "editable": true }, @@ -1092,7 +1092,7 @@ }, { "cell_type": "markdown", - "id": "eef642cb", + "id": "b0771c96", "metadata": { "editable": true }, @@ -1104,7 +1104,7 @@ }, { "cell_type": "markdown", - "id": "59957c90", + "id": "490ba19d", "metadata": { "editable": true }, @@ -1115,7 +1115,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "50f4bb32", + "id": "a4638b4a", "metadata": { "collapsed": false, "editable": true @@ -1160,7 +1160,7 @@ }, { "cell_type": "markdown", - "id": "317adcde", + "id": "1ebd2eda", "metadata": { "editable": true }, @@ -1177,7 +1177,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "edcf7409", + "id": "bd61cdf6", "metadata": { "collapsed": false, "editable": true @@ -1205,7 +1205,7 @@ }, { "cell_type": "markdown", - "id": "2527d8e3", + "id": "02a4c4b9", "metadata": { "editable": true }, @@ -1220,7 +1220,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "4d3b3e47", + "id": "cc20df7d", "metadata": { "collapsed": false, "editable": true @@ -1264,7 +1264,7 @@ }, { "cell_type": "markdown", - "id": "ccda9af0", + "id": "95b76c23", "metadata": { "editable": true }, @@ -1274,7 +1274,7 @@ }, { "cell_type": "markdown", - "id": "1afdd408", + "id": "9a7c62d5", "metadata": { "editable": true }, @@ -1285,7 +1285,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "29b65a10", + "id": "2f836f3c", "metadata": { "collapsed": false, "editable": true @@ -1313,7 +1313,7 @@ }, { "cell_type": "markdown", - "id": "d9696e5d", + "id": "c3b33087", "metadata": { "editable": true }, @@ -1328,7 +1328,7 @@ }, { "cell_type": "markdown", - "id": "5c1d0929", + "id": "87ad6d05", "metadata": { "editable": true }, @@ -1339,7 +1339,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "ed53fa0d", + "id": "72cd7440", "metadata": { "collapsed": false, "editable": true @@ -1367,7 +1367,7 @@ }, { "cell_type": "markdown", - "id": "5eac99a4", + "id": "76ff845c", "metadata": { "editable": true }, @@ -1378,7 +1378,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "38f58077", + "id": "90719a0e", "metadata": { "collapsed": false, "editable": true @@ -1403,7 +1403,7 @@ }, { "cell_type": "markdown", - "id": "718496fd", + "id": "0009d423", "metadata": { "editable": true }, @@ -1414,7 +1414,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "d3e27a0f", + "id": "dacfa26f", "metadata": { "collapsed": false, "editable": true @@ -1450,7 +1450,7 @@ { "cell_type": "code", "execution_count": 11, - "id": "bbe80620", + "id": "81789038", "metadata": { "collapsed": false, "editable": true @@ -1470,7 +1470,7 @@ }, { "cell_type": "markdown", - "id": "6df180ad", + "id": "73769c7f", "metadata": { "editable": true }, @@ -1481,7 +1481,7 @@ { "cell_type": "code", "execution_count": 12, - "id": "aa358c95", + "id": "8a023f81", "metadata": { "collapsed": false, "editable": true @@ -1519,7 +1519,7 @@ }, { "cell_type": "markdown", - "id": "43813417", + "id": "88c98aa0", "metadata": { "editable": true }, @@ -1529,7 +1529,7 @@ }, { "cell_type": "markdown", - "id": "b58f0647", + "id": "2cb88a5d", "metadata": { "editable": true }, @@ -1543,7 +1543,7 @@ { "cell_type": "code", "execution_count": 13, - "id": "eca29a55", + "id": "ed3ac3e3", "metadata": { "collapsed": false, "editable": true @@ -1565,7 +1565,7 @@ }, { "cell_type": "markdown", - "id": "94719822", + "id": "452ee1c7", "metadata": { "editable": true }, @@ -1575,7 +1575,7 @@ }, { "cell_type": "markdown", - "id": "cae849a6", + "id": "492c3948", "metadata": { "editable": true }, @@ -1586,7 +1586,7 @@ { "cell_type": "code", "execution_count": 14, - "id": "7e04cd29", + "id": "5c0be95c", "metadata": { "collapsed": false, "editable": true @@ -1608,7 +1608,7 @@ }, { "cell_type": "markdown", - "id": "fd1a0abf", + "id": "878ebbaa", "metadata": { "editable": true }, @@ -1621,7 +1621,7 @@ { "cell_type": "code", "execution_count": 15, - "id": "cfd05a8c", + "id": "35744b22", "metadata": { "collapsed": false, "editable": true @@ -1646,7 +1646,7 @@ }, { "cell_type": "markdown", - "id": "df1070a4", + "id": "7155b378", "metadata": { "editable": true }, @@ -1658,7 +1658,7 @@ { "cell_type": "code", "execution_count": 16, - "id": "b685a67e", + "id": "263ae33c", "metadata": { "collapsed": false, "editable": true @@ -1673,7 +1673,7 @@ }, { "cell_type": "markdown", - "id": "e5d540f6", + "id": "21aa6af8", "metadata": { "editable": true }, @@ -1688,7 +1688,7 @@ { "cell_type": "code", "execution_count": 17, - "id": "c388bc78", + "id": "54f02097", "metadata": { "collapsed": false, "editable": true @@ -1748,7 +1748,103 @@ }, { "cell_type": "markdown", - "id": "64607a50", + "id": "9e6d50fa", + "metadata": { + "editable": true + }, + "source": [ + "## Including Stochastic Gradient Descent with Autograd\n", + "In this code we include the stochastic gradient descent approach discussed above. Note here that we specify which argument we are taking the derivative with respect to when using **autograd**." + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "95265123", + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], + "source": [ + "# Using Autograd to calculate gradients using SGD\n", + "# OLS example\n", + "from random import random, seed\n", + "import numpy as np\n", + "import autograd.numpy as np\n", + "import matplotlib.pyplot as plt\n", + "from autograd import grad\n", + "\n", + "# Note change from previous example\n", + "def CostOLS(y,X,theta):\n", + " return np.sum((y-X @ theta)**2)\n", + "\n", + "n = 100\n", + "x = 2*np.random.rand(n,1)\n", + "y = 4+3*x+np.random.randn(n,1)\n", + "\n", + "X = np.c_[np.ones((n,1)), x]\n", + "XT_X = X.T @ X\n", + "theta_linreg = np.linalg.pinv(XT_X) @ (X.T @ y)\n", + "print(\"Own inversion\")\n", + "print(theta_linreg)\n", + "# Hessian matrix\n", + "H = (2.0/n)* XT_X\n", + "EigValues, EigVectors = np.linalg.eig(H)\n", + "print(f\"Eigenvalues of Hessian Matrix:{EigValues}\")\n", + "\n", + "theta = np.random.randn(2,1)\n", + "eta = 1.0/np.max(EigValues)\n", + "Niterations = 1000\n", + "\n", + "# Note that we request the derivative wrt third argument (theta, 2 here)\n", + "training_gradient = grad(CostOLS,2)\n", + "\n", + "for iter in range(Niterations):\n", + " gradients = (1.0/n)*training_gradient(y, X, theta)\n", + " theta -= eta*gradients\n", + "print(\"theta from own gd\")\n", + "print(theta)\n", + "\n", + "xnew = np.array([[0],[2]])\n", + "Xnew = np.c_[np.ones((2,1)), xnew]\n", + "ypredict = Xnew.dot(theta)\n", + "ypredict2 = Xnew.dot(theta_linreg)\n", + "\n", + "plt.plot(xnew, ypredict, \"r-\")\n", + "plt.plot(xnew, ypredict2, \"b-\")\n", + "plt.plot(x, y ,'ro')\n", + "plt.axis([0,2.0,0, 15.0])\n", + "plt.xlabel(r'$x$')\n", + "plt.ylabel(r'$y$')\n", + "plt.title(r'Random numbers ')\n", + "plt.show()\n", + "\n", + "n_epochs = 50\n", + "M = 5 #size of each minibatch\n", + "m = int(n/M) #number of minibatches\n", + "t0, t1 = 5, 50\n", + "def learning_schedule(t):\n", + " return t0/(t+t1)\n", + "\n", + "theta = np.random.randn(2,1)\n", + "\n", + "for epoch in range(n_epochs):\n", + "# Can you figure out a better way of setting up the contributions to each batch?\n", + " for i in range(m):\n", + " random_index = np.random.randint(m)\n", + " xi = X[random_index*M:random_index*M+M]\n", + " yi = y[random_index*M:random_index*M+M]\n", + " gradients = (2.0/M)*training_gradient(yi, xi, theta)\n", + " eta = learning_schedule(epoch*m+i)\n", + " theta = theta - eta*gradients\n", + "print(\"theta from own sdg\")\n", + "print(theta)" + ] + }, + { + "cell_type": "markdown", + "id": "f136ad8d", "metadata": { "editable": true }, @@ -1758,8 +1854,8 @@ }, { "cell_type": "code", - "execution_count": 18, - "id": "3d2284e1", + "execution_count": 19, + "id": "c565eefd", "metadata": { "collapsed": false, "editable": true @@ -1803,7 +1899,7 @@ }, { "cell_type": "markdown", - "id": "72ffd750", + "id": "e8994c9d", "metadata": { "editable": true }, @@ -1817,7 +1913,7 @@ }, { "cell_type": "markdown", - "id": "9bf9f3be", + "id": "b60dc921", "metadata": { "editable": true }, @@ -1835,7 +1931,7 @@ }, { "cell_type": "markdown", - "id": "d056da98", + "id": "fd7c1d6b", "metadata": { "editable": true }, @@ -1859,7 +1955,7 @@ }, { "cell_type": "markdown", - "id": "5759441f", + "id": "d34115ec", "metadata": { "editable": true }, @@ -1877,7 +1973,7 @@ }, { "cell_type": "markdown", - "id": "cbaf7593", + "id": "c5e82cb4", "metadata": { "editable": true }, @@ -1917,7 +2013,7 @@ }, { "cell_type": "markdown", - "id": "869155a6", + "id": "153d950b", "metadata": { "editable": true }, @@ -1946,7 +2042,7 @@ }, { "cell_type": "markdown", - "id": "4de16ff6", + "id": "9ca9a5c9", "metadata": { "editable": true }, @@ -1967,7 +2063,7 @@ }, { "cell_type": "markdown", - "id": "39ee67f4", + "id": "dceb31cf", "metadata": { "editable": true }, @@ -1996,7 +2092,7 @@ }, { "cell_type": "markdown", - "id": "f49eaf79", + "id": "04880cf8", "metadata": { "editable": true }, @@ -2017,7 +2113,7 @@ }, { "cell_type": "markdown", - "id": "523ea08c", + "id": "a9312de2", "metadata": { "editable": true }, @@ -2038,7 +2134,7 @@ }, { "cell_type": "markdown", - "id": "5117a936", + "id": "d2597fdc", "metadata": { "editable": true }, @@ -2055,7 +2151,7 @@ }, { "cell_type": "markdown", - "id": "0ca8f7f9", + "id": "7f401b4d", "metadata": { "editable": true }, @@ -2076,7 +2172,7 @@ }, { "cell_type": "markdown", - "id": "2b8f1841", + "id": "c8f771bf", "metadata": { "editable": true }, @@ -2092,7 +2188,7 @@ }, { "cell_type": "markdown", - "id": "3fb6d603", + "id": "f1be67dd", "metadata": { "editable": true }, @@ -2108,8 +2204,8 @@ }, { "cell_type": "code", - "execution_count": 19, - "id": "14a41974", + "execution_count": 20, + "id": "bf659192", "metadata": { "collapsed": false, "editable": true @@ -2150,7 +2246,7 @@ }, { "cell_type": "markdown", - "id": "171657a5", + "id": "d96eb58b", "metadata": { "editable": true }, @@ -2160,7 +2256,7 @@ }, { "cell_type": "markdown", - "id": "a5aee50f", + "id": "855e5b9d", "metadata": { "editable": true }, @@ -2170,8 +2266,8 @@ }, { "cell_type": "code", - "execution_count": 20, - "id": "f45a24ef", + "execution_count": 21, + "id": "9f7fb553", "metadata": { "collapsed": false, "editable": true @@ -2231,7 +2327,7 @@ }, { "cell_type": "markdown", - "id": "ab2e1b05", + "id": "97a10f63", "metadata": { "editable": true }, @@ -2241,7 +2337,7 @@ }, { "cell_type": "markdown", - "id": "d95335c8", + "id": "8bef3dd5", "metadata": { "editable": true }, @@ -2251,8 +2347,8 @@ }, { "cell_type": "code", - "execution_count": 21, - "id": "5544387f", + "execution_count": 22, + "id": "0217c385", "metadata": { "collapsed": false, "editable": true @@ -2272,7 +2368,7 @@ }, { "cell_type": "markdown", - "id": "2695ce19", + "id": "dce7493f", "metadata": { "editable": true }, @@ -2284,7 +2380,7 @@ }, { "cell_type": "markdown", - "id": "e18a9338", + "id": "45794322", "metadata": { "editable": true }, @@ -2296,7 +2392,7 @@ }, { "cell_type": "markdown", - "id": "c2905f68", + "id": "7a9de81a", "metadata": { "editable": true }, @@ -2311,7 +2407,7 @@ }, { "cell_type": "markdown", - "id": "60d792d0", + "id": "fdda1f07", "metadata": { "editable": true }, @@ -2323,7 +2419,7 @@ }, { "cell_type": "markdown", - "id": "94458bdf", + "id": "9524f638", "metadata": { "editable": true }, @@ -2340,7 +2436,7 @@ }, { "cell_type": "markdown", - "id": "e34712f2", + "id": "a0e26b0f", "metadata": { "editable": true }, @@ -2355,7 +2451,7 @@ }, { "cell_type": "markdown", - "id": "e41b630a", + "id": "087299fd", "metadata": { "editable": true }, @@ -2373,7 +2469,7 @@ }, { "cell_type": "markdown", - "id": "8ab39da3", + "id": "b07ec0ac", "metadata": { "editable": true }, @@ -2385,7 +2481,7 @@ }, { "cell_type": "markdown", - "id": "db58ccab", + "id": "9eb05c72", "metadata": { "editable": true }, @@ -2403,7 +2499,7 @@ }, { "cell_type": "markdown", - "id": "f6618529", + "id": "0fae4fc2", "metadata": { "editable": true }, @@ -2416,7 +2512,7 @@ }, { "cell_type": "markdown", - "id": "91ff27c8", + "id": "9ecda7bb", "metadata": { "editable": true }, @@ -2428,7 +2524,7 @@ }, { "cell_type": "markdown", - "id": "4b81a402", + "id": "d1023fd9", "metadata": { "editable": true }, @@ -2446,7 +2542,7 @@ }, { "cell_type": "markdown", - "id": "0cc570c3", + "id": "4982f798", "metadata": { "editable": true }, @@ -2464,7 +2560,7 @@ }, { "cell_type": "markdown", - "id": "e83eb8f8", + "id": "9fb25411", "metadata": { "editable": true }, @@ -2474,7 +2570,7 @@ }, { "cell_type": "markdown", - "id": "38cf7e9f", + "id": "7607d280", "metadata": { "editable": true }, @@ -2492,7 +2588,7 @@ }, { "cell_type": "markdown", - "id": "d23a5eab", + "id": "6356f959", "metadata": { "editable": true }, @@ -2511,7 +2607,7 @@ }, { "cell_type": "markdown", - "id": "8f081f26", + "id": "c5e33d21", "metadata": { "editable": true }, @@ -2524,7 +2620,7 @@ }, { "cell_type": "markdown", - "id": "a858039f", + "id": "e86b6000", "metadata": { "editable": true }, @@ -2542,7 +2638,7 @@ }, { "cell_type": "markdown", - "id": "b4e3b47d", + "id": "7813cdda", "metadata": { "editable": true }, @@ -2553,7 +2649,7 @@ }, { "cell_type": "markdown", - "id": "b096e697", + "id": "4b6e2c05", "metadata": { "editable": true }, @@ -2572,7 +2668,7 @@ }, { "cell_type": "markdown", - "id": "789f5372", + "id": "8d21fc10", "metadata": { "editable": true }, @@ -2590,7 +2686,7 @@ }, { "cell_type": "markdown", - "id": "5c28d1bd", + "id": "60f584ec", "metadata": { "editable": true }, @@ -2603,7 +2699,7 @@ }, { "cell_type": "markdown", - "id": "b6ce620f", + "id": "ae5c91ab", "metadata": { "editable": true }, @@ -2623,7 +2719,7 @@ }, { "cell_type": "markdown", - "id": "576bfc5e", + "id": "6a4966cf", "metadata": { "editable": true }, @@ -2656,7 +2752,7 @@ }, { "cell_type": "markdown", - "id": "036597c9", + "id": "c10d3258", "metadata": { "editable": true }, @@ -2668,7 +2764,7 @@ }, { "cell_type": "markdown", - "id": "cb9f0517", + "id": "a0822fc5", "metadata": { "editable": true }, @@ -2687,7 +2783,7 @@ }, { "cell_type": "markdown", - "id": "30e02d34", + "id": "344cc850", "metadata": { "editable": true }, @@ -2701,7 +2797,7 @@ }, { "cell_type": "markdown", - "id": "17d265b0", + "id": "5cf49f38", "metadata": { "editable": true }, @@ -2724,7 +2820,7 @@ }, { "cell_type": "markdown", - "id": "baa43d4f", + "id": "a8d8a0c4", "metadata": { "editable": true }, @@ -2743,7 +2839,7 @@ }, { "cell_type": "markdown", - "id": "d5eb3512", + "id": "f4039df2", "metadata": { "editable": true }, @@ -2755,7 +2851,7 @@ }, { "cell_type": "markdown", - "id": "8a42bdcb", + "id": "5bfe16d7", "metadata": { "editable": true }, @@ -2765,7 +2861,7 @@ }, { "cell_type": "markdown", - "id": "d4731af5", + "id": "9c0053a5", "metadata": { "editable": true }, @@ -2777,7 +2873,7 @@ }, { "cell_type": "markdown", - "id": "7a20542c", + "id": "ee719a5b", "metadata": { "editable": true }, @@ -2793,8 +2889,8 @@ }, { "cell_type": "code", - "execution_count": 22, - "id": "357bad82", + "execution_count": 23, + "id": "ce0a726a", "metadata": { "collapsed": false, "editable": true @@ -2876,7 +2972,7 @@ }, { "cell_type": "markdown", - "id": "74cea384", + "id": "67c1d4e9", "metadata": { "editable": true }, @@ -2914,7 +3010,7 @@ }, { "cell_type": "markdown", - "id": "41eef3ea", + "id": "b0f10db3", "metadata": { "editable": true }, @@ -2944,7 +3040,7 @@ }, { "cell_type": "markdown", - "id": "3ce9aab9", + "id": "92203fb4", "metadata": { "editable": true }, @@ -2965,7 +3061,7 @@ }, { "cell_type": "markdown", - "id": "eab8fa4c", + "id": "6755430b", "metadata": { "editable": true }, @@ -2977,7 +3073,7 @@ }, { "cell_type": "markdown", - "id": "8eba3b68", + "id": "fb15dd2f", "metadata": { "editable": true }, @@ -2992,7 +3088,7 @@ }, { "cell_type": "markdown", - "id": "5adcf868", + "id": "50b70e8e", "metadata": { "editable": true }, @@ -3009,7 +3105,7 @@ }, { "cell_type": "markdown", - "id": "952bb8ff", + "id": "0914d857", "metadata": { "editable": true }, @@ -3021,7 +3117,7 @@ }, { "cell_type": "markdown", - "id": "a399c54d", + "id": "42ee574d", "metadata": { "editable": true }, @@ -3034,7 +3130,7 @@ }, { "cell_type": "markdown", - "id": "f90f091e", + "id": "74ab9769", "metadata": { "editable": true }, @@ -3046,7 +3142,7 @@ }, { "cell_type": "markdown", - "id": "de49f450", + "id": "887bdbbf", "metadata": { "editable": true }, @@ -3060,7 +3156,7 @@ }, { "cell_type": "markdown", - "id": "9d9cb971", + "id": "955a6aa0", "metadata": { "editable": true }, @@ -3072,7 +3168,7 @@ }, { "cell_type": "markdown", - "id": "4d1e65be", + "id": "cba6e7a3", "metadata": { "editable": true }, @@ -3084,7 +3180,7 @@ }, { "cell_type": "markdown", - "id": "f290c2d0", + "id": "6974ae9d", "metadata": { "editable": true }, @@ -3096,7 +3192,7 @@ }, { "cell_type": "markdown", - "id": "6d72efb9", + "id": "fb9b70f8", "metadata": { "editable": true }, @@ -3106,7 +3202,7 @@ }, { "cell_type": "markdown", - "id": "d854b5a3", + "id": "e1c0e49d", "metadata": { "editable": true }, @@ -3118,7 +3214,7 @@ }, { "cell_type": "markdown", - "id": "6861b0e8", + "id": "9cf72b96", "metadata": { "editable": true }, @@ -3128,7 +3224,7 @@ }, { "cell_type": "markdown", - "id": "05c68c37", + "id": "1740efe7", "metadata": { "editable": true }, @@ -3140,7 +3236,7 @@ }, { "cell_type": "markdown", - "id": "f58c61ff", + "id": "984a0649", "metadata": { "editable": true }, @@ -3154,7 +3250,7 @@ }, { "cell_type": "markdown", - "id": "a743dada", + "id": "dd62eb2d", "metadata": { "editable": true }, @@ -3166,7 +3262,7 @@ }, { "cell_type": "markdown", - "id": "ec9f443f", + "id": "f6b0248e", "metadata": { "editable": true }, @@ -3176,7 +3272,7 @@ }, { "cell_type": "markdown", - "id": "c9854185", + "id": "70335126", "metadata": { "editable": true }, @@ -3188,7 +3284,7 @@ }, { "cell_type": "markdown", - "id": "2d5af5c2", + "id": "674ed935", "metadata": { "editable": true }, @@ -3198,7 +3294,7 @@ }, { "cell_type": "markdown", - "id": "c496c0d8", + "id": "da979440", "metadata": { "editable": true }, @@ -3210,7 +3306,7 @@ }, { "cell_type": "markdown", - "id": "1bd29544", + "id": "009e951d", "metadata": { "editable": true }, @@ -3222,7 +3318,7 @@ }, { "cell_type": "markdown", - "id": "b93d3dc3", + "id": "1d994773", "metadata": { "editable": true }, @@ -3234,7 +3330,7 @@ }, { "cell_type": "markdown", - "id": "67c60944", + "id": "1e2a9586", "metadata": { "editable": true }, @@ -3244,7 +3340,7 @@ }, { "cell_type": "markdown", - "id": "6615b99d", + "id": "e8f99c9e", "metadata": { "editable": true }, @@ -3256,7 +3352,7 @@ }, { "cell_type": "markdown", - "id": "c5f86316", + "id": "a04289ae", "metadata": { "editable": true }, @@ -3266,7 +3362,7 @@ }, { "cell_type": "markdown", - "id": "83a838d1", + "id": "2ee50711", "metadata": { "editable": true }, @@ -3278,7 +3374,7 @@ }, { "cell_type": "markdown", - "id": "73197600", + "id": "6edfc5dc", "metadata": { "editable": true }, @@ -3302,7 +3398,7 @@ }, { "cell_type": "markdown", - "id": "2db70712", + "id": "46ee5244", "metadata": { "editable": true }, @@ -3314,7 +3410,7 @@ }, { "cell_type": "markdown", - "id": "05956f58", + "id": "49d84243", "metadata": { "editable": true }, @@ -3324,7 +3420,7 @@ }, { "cell_type": "markdown", - "id": "6fc58145", + "id": "56613bb1", "metadata": { "editable": true }, @@ -3336,7 +3432,7 @@ }, { "cell_type": "markdown", - "id": "f4987a3b", + "id": "4e0c595d", "metadata": { "editable": true }, @@ -3348,7 +3444,7 @@ }, { "cell_type": "markdown", - "id": "a0ecdc3d", + "id": "18d63f4f", "metadata": { "editable": true }, @@ -3360,7 +3456,7 @@ }, { "cell_type": "markdown", - "id": "67c73d46", + "id": "83539a64", "metadata": { "editable": true }, @@ -3370,7 +3466,7 @@ }, { "cell_type": "markdown", - "id": "ba924a9d", + "id": "3fadddb8", "metadata": { "editable": true }, @@ -3382,7 +3478,7 @@ }, { "cell_type": "markdown", - "id": "4d6e2a70", + "id": "b570ccfb", "metadata": { "editable": true }, @@ -3392,7 +3488,7 @@ }, { "cell_type": "markdown", - "id": "3bae7f92", + "id": "299cbb0c", "metadata": { "editable": true }, @@ -3406,7 +3502,7 @@ }, { "cell_type": "markdown", - "id": "c5ff0c7b", + "id": "cd426846", "metadata": { "editable": true }, @@ -3424,7 +3520,7 @@ }, { "cell_type": "markdown", - "id": "6a69a16a", + "id": "ee9de6fc", "metadata": { "editable": true }, @@ -3434,7 +3530,7 @@ }, { "cell_type": "markdown", - "id": "d92a957f", + "id": "5a3fb6d8", "metadata": { "editable": true }, @@ -3452,7 +3548,7 @@ }, { "cell_type": "markdown", - "id": "0f22838d", + "id": "e4d9983f", "metadata": { "editable": true }, @@ -3462,7 +3558,7 @@ }, { "cell_type": "markdown", - "id": "0ebff954", + "id": "df4bc05e", "metadata": { "editable": true }, @@ -3480,7 +3576,7 @@ }, { "cell_type": "markdown", - "id": "24ef899b", + "id": "5bc2cf34", "metadata": { "editable": true }, @@ -3507,7 +3603,7 @@ }, { "cell_type": "markdown", - "id": "69788581", + "id": "50b8b1e2", "metadata": { "editable": true }, @@ -3519,7 +3615,7 @@ }, { "cell_type": "markdown", - "id": "4bd33409", + "id": "bbde849a", "metadata": { "editable": true }, @@ -3531,7 +3627,7 @@ }, { "cell_type": "markdown", - "id": "2e0ef762", + "id": "16451372", "metadata": { "editable": true }, @@ -3541,7 +3637,7 @@ }, { "cell_type": "markdown", - "id": "f111f843", + "id": "3918985e", "metadata": { "editable": true }, @@ -3553,7 +3649,7 @@ }, { "cell_type": "markdown", - "id": "ec1ab4df", + "id": "89abd340", "metadata": { "editable": true }, @@ -3563,7 +3659,7 @@ }, { "cell_type": "markdown", - "id": "94a0903b", + "id": "ebb68622", "metadata": { "editable": true }, @@ -3575,7 +3671,7 @@ }, { "cell_type": "markdown", - "id": "a835d8f7", + "id": "ed39bd8f", "metadata": { "editable": true }, @@ -3585,7 +3681,7 @@ }, { "cell_type": "markdown", - "id": "ff019efd", + "id": "86fe1bde", "metadata": { "editable": true }, @@ -3597,7 +3693,7 @@ }, { "cell_type": "markdown", - "id": "21e31f52", + "id": "4cc0b6fb", "metadata": { "editable": true }, @@ -3609,7 +3705,7 @@ }, { "cell_type": "markdown", - "id": "da2e17f6", + "id": "9a75f32a", "metadata": { "editable": true }, @@ -3632,7 +3728,7 @@ }, { "cell_type": "markdown", - "id": "a2f06c0b", + "id": "44bc8455", "metadata": { "editable": true }, @@ -3644,7 +3740,7 @@ }, { "cell_type": "markdown", - "id": "ae687c79", + "id": "d29e9ac2", "metadata": { "editable": true }, @@ -3654,7 +3750,7 @@ }, { "cell_type": "markdown", - "id": "ffe7631c", + "id": "1224c135", "metadata": { "editable": true }, @@ -3666,7 +3762,7 @@ }, { "cell_type": "markdown", - "id": "2291a744", + "id": "6d66941f", "metadata": { "editable": true }, @@ -3676,7 +3772,7 @@ }, { "cell_type": "markdown", - "id": "86b0155e", + "id": "b6c51464", "metadata": { "editable": true }, @@ -3688,7 +3784,7 @@ }, { "cell_type": "markdown", - "id": "d77a593c", + "id": "9566a11e", "metadata": { "editable": true }, @@ -3700,7 +3796,7 @@ }, { "cell_type": "markdown", - "id": "6fab7a45", + "id": "9d66e99e", "metadata": { "editable": true }, diff --git a/doc/src/week40/week40.do.txt b/doc/src/week40/week40.do.txt index 85993cbab..547f60e21 100644 --- a/doc/src/week40/week40.do.txt +++ b/doc/src/week40/week40.do.txt @@ -966,6 +966,89 @@ plt.ylabel(r'$y$') plt.title(r'Random numbers ') plt.show() +!ec + + +!split +===== Including Stochastic Gradient Descent with Autograd ===== +In this code we include the stochastic gradient descent approach discussed above. Note here that we specify which argument we are taking the derivative with respect to when using _autograd_. + +!bc pycod +# Using Autograd to calculate gradients using SGD +# OLS example +from random import random, seed +import numpy as np +import autograd.numpy as np +import matplotlib.pyplot as plt +from autograd import grad + +# Note change from previous example +def CostOLS(y,X,theta): + return np.sum((y-X @ theta)**2) + +n = 100 +x = 2*np.random.rand(n,1) +y = 4+3*x+np.random.randn(n,1) + +X = np.c_[np.ones((n,1)), x] +XT_X = X.T @ X +theta_linreg = np.linalg.pinv(XT_X) @ (X.T @ y) +print("Own inversion") +print(theta_linreg) +# Hessian matrix +H = (2.0/n)* XT_X +EigValues, EigVectors = np.linalg.eig(H) +print(f"Eigenvalues of Hessian Matrix:{EigValues}") + +theta = np.random.randn(2,1) +eta = 1.0/np.max(EigValues) +Niterations = 1000 + +# Note that we request the derivative wrt third argument (theta, 2 here) +training_gradient = grad(CostOLS,2) + +for iter in range(Niterations): + gradients = (1.0/n)*training_gradient(y, X, theta) + theta -= eta*gradients +print("theta from own gd") +print(theta) + +xnew = np.array([[0],[2]]) +Xnew = np.c_[np.ones((2,1)), xnew] +ypredict = Xnew.dot(theta) +ypredict2 = Xnew.dot(theta_linreg) + +plt.plot(xnew, ypredict, "r-") +plt.plot(xnew, ypredict2, "b-") +plt.plot(x, y ,'ro') +plt.axis([0,2.0,0, 15.0]) +plt.xlabel(r'$x$') +plt.ylabel(r'$y$') +plt.title(r'Random numbers ') +plt.show() + +n_epochs = 50 +M = 5 #size of each minibatch +m = int(n/M) #number of minibatches +t0, t1 = 5, 50 +def learning_schedule(t): + return t0/(t+t1) + +theta = np.random.randn(2,1) + +for epoch in range(n_epochs): +# Can you figure out a better way of setting up the contributions to each batch? + for i in range(m): + random_index = np.random.randint(m) + xi = X[random_index*M:random_index*M+M] + yi = y[random_index*M:random_index*M+M] + gradients = (2.0/M)*training_gradient(yi, xi, theta) + eta = learning_schedule(epoch*m+i) + theta = theta - eta*gradients +print("theta from own sdg") +print(theta) + + !ec !split