diff --git a/doc/pub/week40/html/week40-bs.html b/doc/pub/week40/html/week40-bs.html index e6b2aaf46..43ef491d4 100644 --- a/doc/pub/week40/html/week40-bs.html +++ b/doc/pub/week40/html/week40-bs.html @@ -1,11 +1,11 @@ - + @@ -41,90 +41,144 @@ Automatically generated HTML file from DocOnce source @@ -162,64 +216,64 @@ MathJax.Hub.Config({ @@ -250,11 +304,11 @@ MathJax.Hub.Config({

-

[1] Department of Physics, University of Oslo
-
[2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University
+
[1] Department of Physics, University of Oslo, Norway
+
[2] Department of Physics and Astronomy and Facility for Rare Ion Beams, Michigan State University, USA

-

Oct 6, 2020

+

Oct 4, 2021


@@ -290,13 +344,13 @@ MathJax.Hub.Config({

- © 1999-2020, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2021, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
diff --git a/doc/pub/week40/html/week40-reveal.html b/doc/pub/week40/html/week40-reveal.html index 9c1418a8e..a6a3d134f 100644 --- a/doc/pub/week40/html/week40-reveal.html +++ b/doc/pub/week40/html/week40-reveal.html @@ -1,7 +1,7 @@ - + @@ -13,7 +13,7 @@ - + @@ -76,10 +76,10 @@ document.getElementsByTagName( 'head' )[0].appendChild( link ); .reveal .alert-block > p, .alert-block > ul {margin-bottom:1em} /*.reveal .alert li {margin-top: 1em}*/ .reveal .alert-block p+p {margin-top:5px} - /*.reveal .alert-notice { background-image: url(http://hplgit.github.io/doconce/bundled/html_images/small_gray_notice.png); } - .reveal .alert-summary { background-image:url(http://hplgit.github.io/doconce/bundled/html_images/small_gray_summary.png); } - .reveal .alert-warning { background-image: url(http://hplgit.github.io/doconce/bundled/html_images/small_gray_warning.png); } - .reveal .alert-question {background-image:url(http://hplgit.github.io/doconce/bundled/html_images/small_gray_question.png); } */ + /*.reveal .alert-notice { background-image: url(https://hplgit.github.io/doconce/bundled/html_images/small_gray_notice.png); } + .reveal .alert-summary { background-image:url(https://hplgit.github.io/doconce/bundled/html_images/small_gray_summary.png); } + .reveal .alert-warning { background-image: url(https://hplgit.github.io/doconce/bundled/html_images/small_gray_warning.png); } + .reveal .alert-question {background-image:url(https://hplgit.github.io/doconce/bundled/html_images/small_gray_question.png); } */ @@ -144,36 +144,37 @@ MathJax.Hub.Config({

 
-

[1] Department of Physics, University of Oslo
-
[2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University
+
[1] Department of Physics, University of Oslo, Norway
+
[2] Department of Physics and Astronomy and Facility for Rare Ion Beams, Michigan State University, USA

 
-

Oct 6, 2020

+

Oct 4, 2021


- © 1999-2020, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2021, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
-

Plan for week 40

+

Plan for week 40

Reading suggestions for both days: Aurelien Geron's chapter 10 and Hastie et al chapter 11. For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text. +For neural networks we recommend Goodfellow et al chapters 6 and 7 and Bishop 5.1-5.4

-

Overview video for week 40

+

Overview video for week 40

Overview Video, from Stochastic Gradient methods to Neural Networks @@ -181,7 +182,7 @@ For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text.

-

Stochastic Gradient Descent

+

Stochastic Gradient Descent

Stochastic gradient descent (SGD) and variants thereof address some of @@ -201,7 +202,7 @@ $$

-

Computation of gradients

+

Computation of gradients

This in turn means that the gradient can be @@ -223,7 +224,7 @@ minibatches. We denote these minibatches by \( B_k \) where

-

SGD example

+

SGD example

As an example, suppose we have \( 10 \) data points \( (\mathbf{x}_1,\cdots, \mathbf{x}_{10}) \) and we choose to have \( M=5 \) minibathces, then each minibatch contains two data points. In particular we have @@ -249,7 +250,7 @@ $$
-

The gradient step

+

The gradient step

Thus a gradient descent step now looks like @@ -270,12 +271,12 @@ the number of minibatches, as exemplified in the code below.

-

Simple example code

+

Simple example code

-

import numpy as np 
+
import numpy as np 
 
 n = 100 #100 datapoints 
 M = 5   #size of each minibatch
@@ -302,7 +303,7 @@ all \( n \) datapoints.
 
 
 
-

When do we stop?

+

When do we stop?

A natural question is when do we stop the search for a new minimum? @@ -319,7 +320,7 @@ gave the lowest value.

-

Slightly different approach

+

Slightly different approach

Another approach is to let the step length \( \gamma_j \) depend on the @@ -341,7 +342,7 @@ function.

-

import numpy as np 
+
import numpy as np 
 
 def step_length(t,t0,t1):
     return t0/(t+t1)
@@ -370,12 +371,12 @@ j = 0
 
 
 
-

Program for stochastic gradient

+

Program for stochastic gradient

-

# Importing various packages
+
# Importing various packages
 from math import exp, sqrt
 from random import random, seed
 import numpy as np
@@ -446,7 +447,7 @@ plt.show()
 
 
 
-

Momentum based GD

+

Momentum based GD

The stochastic gradient descent (SGD) is almost always used with a @@ -487,7 +488,7 @@ where we have defined \( \Delta \boldsymbol{\theta}_{t}= \boldsymbol{\theta}_t-\

-

More on momentum based approaches

+

More on momentum based approaches

Let us try to get more intuition from these equations. It is helpful @@ -523,7 +524,7 @@ $$

-

Momentum parameter

+

Momentum parameter

Notice that this equation is identical to previous one if we identify @@ -583,7 +584,7 @@ One of the major advantages of NAG is that it allows for the use of a larger lea

-

Second moment of the gradient

+

Second moment of the gradient

In stochastic gradient descent, with and without momentum, we still @@ -611,7 +612,7 @@ ADAM.

-

RMS prop

+

RMS prop

In RMS prop, in addition to keeping a running average of the first @@ -644,7 +645,7 @@ learning rate for flat directions.

-

ADAM optimizer

+

ADAM optimizer

A related algorithm is the ADAM optimizer. In ADAM, we keep a running @@ -697,7 +698,7 @@ $$

-

Practical tips

+

Practical tips

  • Randomize the data when making mini-batches. It is always important to randomly shuffle the data when forming mini-batches. Otherwise, the gradient descent method can fit spurious correlations resulting from the order in which data is presented.
  • @@ -712,7 +713,7 @@ Geron's text, see chapter 11, has several interesting discussions.
    -

    Automatic differentiation

    +

    Automatic differentiation

    Automatic differentiation (AD), @@ -764,7 +765,7 @@ Using autograd we have

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     
     # To do elementwise differentiation:
     from autograd import elementwise_grad as egrad 
    @@ -803,7 +804,7 @@ plt.show()
     
     
     
    -

    Using autograd

    +

    Using autograd

    Here we @@ -815,7 +816,7 @@ experiment with other, possibly more complicated, functions as well.

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     
     def f1(x):
    @@ -837,7 +838,7 @@ grad_analytical = 3*a**Autograd with more complicated functions 
    +

    Autograd with more complicated functions

    To differentiate with respect to two (or more) arguments of a Python @@ -847,7 +848,7 @@ being differentiated with respect to.

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     def f2(x1,x2):
         return 3*x1**3 + x2*(x1 - 5) + 1
    @@ -887,12 +888,12 @@ Note that the grad function will not produce the true gradient of the function.
     
     
     
    -

    More complicated functions using the elements of their arguments directly

    +

    More complicated functions using the elements of their arguments directly

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     def f3(x): # Assumes x is an array of length 5 or higher
         return 2*x[0] + 3*x[1] + 5*x[2] + 7*x[3] + 11*x[4]**2
    @@ -921,12 +922,12 @@ could expect form a gradient-evaluting function.
     
     
     
    -

    Functions using mathematical functions from Numpy

    +

    Functions using mathematical functions from Numpy

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     def f4(x):
         return np.sqrt(1+x**2) + np.exp(x) + np.sin(2*np.pi*x)
    @@ -948,12 +949,12 @@ f4_grad_analytical = x/np.sqrt(1 + x**
    -

    More autograd

    +

    More autograd

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     def f5(x):
         if x >= 0:
    @@ -972,12 +973,12 @@ x = 2.7
     
     
     
    -

    And with loops

    +

    And with loops

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     def f6_for(x):
         val = 0
    @@ -1005,7 +1006,7 @@ x = 0.5
     

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     # Both of the functions are implementation of the sum: sum(x**i) for i = 0, ..., 9
     # The analytical derivative is: sum(i*x**(i-1)) 
    @@ -1019,11 +1020,11 @@ f6_grad_analytical = 0
     
     
     
    -

    Using recursion

    +

    Using recursion

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     
     def f7(n): # Assume that n is an integer
    @@ -1057,7 +1058,7 @@ Note that if n is equal to zero or one, Autograd will give an error message. Thi
     
     
     
    -

    Unsupported functions

    +

    Unsupported functions

    Autograd supports many features. However, there are some functions that is not supported (yet) by Autograd.

    @@ -1065,7 +1066,7 @@ Assigning a value to the variable being differentiated with respect to

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     def f8(x): # Assume x is an array
         x[2] = 3
    @@ -1083,11 +1084,11 @@ Here, Autograd tells us that an 'ArrayBox' does not support item assignment. The
     
     
     
    -

    The syntax a.dot(b) when finding the dot product

    +

    The syntax a.dot(b) when finding the dot product

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     def f9(a): # Assume a is an array with 2 elements
         b = np.array([1.0,2.0])
    @@ -1107,7 +1108,7 @@ which also computed the dot product can be used:
     

    -

    import autograd.numpy as np
    +
    import autograd.numpy as np
     from autograd import grad
     def f9_alternative(x): # Assume a is an array with 2 elements
         b = np.array([1.0,2.0])
    @@ -1126,12 +1127,12 @@ x = np.array([3.0,Recommended to avoid 
    +
     The documentation recommends to avoid inplace operations such as
     

    -

    a += b
    +
    a += b
     a -= b
     a*= b
     a /=b
    @@ -1140,7 +1141,7 @@ a /=b
     
     
     
    -

    Neural networks

    +

    Neural networks

    Artificial neural networks are computational systems that can learn to @@ -1154,7 +1155,7 @@ a weight variable.

    -

    Artificial neurons

    +

    Artificial neurons

    The field of artificial neural networks has a long history of @@ -1220,7 +1221,7 @@ humanities to life science and medicine.

    -

    Neural network types

    +

    Neural network types

    An artificial neural network (ANN), is a computational model that @@ -1247,7 +1248,7 @@ methods we discussed earlier.

    -

    Feed-forward neural networks

    +

    Feed-forward neural networks

    The feed-forward neural network (FFNN) was the first and simplest type @@ -1265,7 +1266,7 @@ to all nodes in the subsequent layer, making this a so-called

    -

    Convolutional Neural Network

    +

    Convolutional Neural Network

    A different variant of FFNNs are convolutional neural networks @@ -1291,7 +1292,7 @@ recognition.

    -

    Recurrent neural networks

    +

    Recurrent neural networks

    So far we have only mentioned ANNs where information flows in one @@ -1308,7 +1309,7 @@ especially well-suited for handwriting and speech recognition.

    -

    Other types of networks

    +

    Other types of networks

    There are many other kinds of ANNs that have been developed. One type @@ -1325,7 +1326,7 @@ type of NN due the unusual activation functions.

    -

    Multilayer perceptrons

    +

    Multilayer perceptrons

    One uses often so-called fully-connected feed-forward neural networks @@ -1339,7 +1340,7 @@ Such networks are often called multilayer perceptrons (MLPs).

    -

    Why multilayer perceptrons?

    +

    Why multilayer perceptrons?

    According to the Universal approximation theorem, a feed-forward @@ -1357,7 +1358,7 @@ as to not restrict the range of output values.

    -

    Mathematical model

    +

    Mathematical model

    The output \( y \) is produced via the activation function \( f \) @@ -1377,7 +1378,7 @@ of the outputs of all neurons in the previous layer.

    -

    Mathematical model

    +

    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 \), @@ -1430,7 +1431,7 @@ is obtained.

    -

    Mathematical model

    +

    Mathematical model

    The output of neuron \( i \) in layer 2 is thus, @@ -1463,7 +1464,7 @@ $$

    -

    Mathematical model

    +

    Mathematical model

    We can generalize this expression to an MLP with \( l \) hidden @@ -1485,7 +1486,7 @@ variables are the input values \( x_n \).

    -

    Mathematical model

    +

    Mathematical model

    This confirms that an MLP, despite its quite convoluted mathematical @@ -1517,7 +1518,7 @@ flexibility of a neural network.

    -

    Matrix-vector notation

    +

    Matrix-vector notation

    We can introduce a more convenient notation for the activations in an A NN. @@ -1559,7 +1560,7 @@ $$

    -

    Matrix-vector notation and activation

    +

    Matrix-vector notation and activation

    The activation of node \( i \) in layer 2 is @@ -1585,7 +1586,7 @@ used as input to the activation functions. For each operation

    -

    Activation functions

    +

    Activation functions

    A property that characterizes a neural network, other than its @@ -1608,7 +1609,7 @@ for a FFNN to fulfill the universal approximation theorem

    -

    Activation functions, Logistic and Hyperbolic ones

    +

    Activation functions, Logistic and Hyperbolic ones

    The second requirement excludes all linear functions. Furthermore, in @@ -1638,7 +1639,7 @@ $$

    -

    Relevance

    +

    Relevance

    The sigmoid function are more biologically plausible because the @@ -1650,7 +1651,7 @@ become the most popular for deep neural networks

    -

    """The sigmoid function (or the logistic curve) is a 
    +
    """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."""
    @@ -1726,7 +1727,7 @@ plt.show()
     
     
     
    -

    The multilayer perceptron (MLP)

    +

    The multilayer perceptron (MLP)

    The multilayer perceptron is a very popular, and easy to implement approach, to deep learning. It consists of @@ -1765,7 +1766,7 @@ like logistic regression or linear regression and their modifications on the oth

    -

    From one to many layers, the universal approximation theorem

    +

    From one to many layers, the universal approximation theorem

    A neural network with only one layer, what we called the simple @@ -1793,7 +1794,7 @@ the potential of being universal approximators.

    -

    Deriving the back propagation code for a multilayer perceptron model

    +

    Deriving the back propagation code for a multilayer perceptron model

    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. @@ -1826,7 +1827,7 @@ classes.

    -

    Definitions

    +

    Definitions

    With our definition of the targets \( \hat{t} \), the outputs of the @@ -1870,7 +1871,7 @@ $$

    -

    Derivatives and the chain rule

    +

    Derivatives and the chain rule

    From the definition of the activation \( z_j^l \) we have @@ -1898,7 +1899,7 @@ $$

    -

    Derivative of the cost function

    +

    Derivative of the cost function

    With these definitions we can now compute the derivative of the cost function in terms of the weights. @@ -1929,7 +1930,7 @@ $$

    -

    Bringing it together, first back propagation equation

    +

    Bringing it together, first back propagation equation

    We have thus @@ -1989,7 +1990,7 @@ $$

    -

    Derivatives in terms of \( z_j^L \)

    +

    Derivatives in terms of \( z_j^L \)

    It is also easy to see that our previous equation can be written as @@ -2012,14 +2013,14 @@ That is, the error \( \delta_j^L \) is exactly equal to the rate of change of th

    -

    Bringing it together

    +

    Bringing it together

    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

    -The starting equations. +The starting equations

     
    $$ \begin{equation} @@ -2076,7 +2077,7 @@ one \( L-1 \) in terms of the errors in the final output layer.

    -

    Final back propagating equation

    +

    Final back propagating equation

    We have that (replacing \( L \) with a general layer \( l \)) @@ -2116,7 +2117,7 @@ We are now ready to set up the algorithm for back propagation and learning the w

    -

    Setting up the Back propagation algorithm

    +

    Setting up the Back propagation algorithm

    The four equations provide us with a way of computing the gradient of the cost function. Let us write this out in the form of an algorithm. diff --git a/doc/pub/week40/html/week40-solarized.html b/doc/pub/week40/html/week40-solarized.html index 44c71f5ec..73fca6ac9 100644 --- a/doc/pub/week40/html/week40-solarized.html +++ b/doc/pub/week40/html/week40-solarized.html @@ -1,19 +1,19 @@ - + Week 40: From Stochastic Gradient Descent to Neural networks - - + + @@ -48,10 +48,10 @@ pre { .alert-block > p, .alert-block > ul {margin-bottom:1em} .alert li {margin-top: 1em} .alert-block p+p {margin-top:5px} -.alert-notice { background-image: url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_yellow_notice.png); } -.alert-summary { background-image:url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_yellow_summary.png); } -.alert-warning { background-image: url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_yellow_warning.png); } -.alert-question {background-image:url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_yellow_question.png); } +.alert-notice { background-image: url(https://cdn.rawgit.com/doconce/doconce/master/bundled/html_images/small_yellow_notice.png); } +.alert-summary { background-image:url(https://cdn.rawgit.com/doconce/doconce/master/bundled/html_images/small_yellow_summary.png); } +.alert-warning { background-image: url(https://cdn.rawgit.com/doconce/doconce/master/bundled/html_images/small_yellow_warning.png); } +.alert-question {background-image:url(https://cdn.rawgit.com/doconce/doconce/master/bundled/html_images/small_yellow_question.png); } div { text-align: justify; text-justify: inter-word; } @@ -61,90 +61,144 @@ div { text-align: justify; text-justify: inter-word; } @@ -182,29 +236,30 @@ MathJax.Hub.Config({

    -

    [1] Department of Physics, University of Oslo
    -
    [2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University
    +
    [1] Department of Physics, University of Oslo, Norway
    +
    [2] Department of Physics and Astronomy and Facility for Rare Ion Beams, Michigan State University, USA

    -

    Oct 6, 2020

    +

    Oct 4, 2021












    -

    Plan for week 40

    +

    Plan for week 40

      -
    • Thursday: Stochastic Gradient descent with examples and automatic differentiation and begin Neural Networks. Video of Lecture
    • -
    • Friday: Neural Networks, setting up the basic steps, from the simple perceptron model to the multi-layer perceptron model. Video of Lecture
    • +
    • Thursday: Stochastic Gradient descent with examples and automatic differentiation and begin Neural Networks.
    • +
    • Friday: Neural Networks, setting up the basic steps, from the simple perceptron model to the multi-layer perceptron model.
    Reading suggestions for both days: Aurelien Geron's chapter 10 and Hastie et al chapter 11. For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text. +For neural networks we recommend Goodfellow et al chapters 6 and 7 and Bishop 5.1-5.4











    -

    Overview video for week 40

    +

    Overview video for week 40

    Overview Video, from Stochastic Gradient methods to Neural Networks @@ -212,7 +267,7 @@ For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text.











    -

    Stochastic Gradient Descent

    +

    Stochastic Gradient Descent

    Stochastic gradient descent (SGD) and variants thereof address some of @@ -230,7 +285,7 @@ $$











    -

    Computation of gradients

    +

    Computation of gradients

    This in turn means that the gradient can be @@ -250,7 +305,7 @@ minibatches. We denote these minibatches by \( B_k \) where











    -

    SGD example

    +

    SGD example

    As an example, suppose we have \( 10 \) data points \( (\mathbf{x}_1,\cdots, \mathbf{x}_{10}) \) and we choose to have \( M=5 \) minibathces, then each minibatch contains two data points. In particular we have @@ -274,7 +329,7 @@ $$











    -

    The gradient step

    +

    The gradient step

    Thus a gradient descent step now looks like @@ -293,12 +348,12 @@ the number of minibatches, as exemplified in the code below.











    -

    Simple example code

    +

    Simple example code

    -

    import numpy as np 
    +
    import numpy as np 
     
     n = 100 #100 datapoints 
     M = 5   #size of each minibatch
    @@ -325,7 +380,7 @@ all \( n \) datapoints.
     











    -

    When do we stop?

    +

    When do we stop?

    A natural question is when do we stop the search for a new minimum? @@ -342,7 +397,7 @@ gave the lowest value.











    -

    Slightly different approach

    +

    Slightly different approach

    Another approach is to let the step length \( \gamma_j \) depend on the @@ -362,7 +417,7 @@ function.

    -

    import numpy as np 
    +
    import numpy as np 
     
     def step_length(t,t0,t1):
         return t0/(t+t1)
    @@ -390,12 +445,12 @@ j = 0
     











    -

    Program for stochastic gradient

    +

    Program for stochastic gradient

    -

    # Importing various packages
    +
    # Importing various packages
     from math import exp, sqrt
     from random import random, seed
     import numpy as np
    @@ -466,7 +521,7 @@ plt.show()
     











    -

    Momentum based GD

    +

    Momentum based GD

    The stochastic gradient descent (SGD) is almost always used with a @@ -503,7 +558,7 @@ where we have defined \( \Delta \boldsymbol{\theta}_{t}= \boldsymbol{\theta}_t-\











    -

    More on momentum based approaches

    +

    More on momentum based approaches

    Let us try to get more intuition from these equations. It is helpful @@ -533,7 +588,7 @@ $$











    -

    Momentum parameter

    +

    Momentum parameter

    Notice that this equation is identical to previous one if we identify @@ -589,7 +644,7 @@ One of the major advantages of NAG is that it allows for the use of a larger lea











    -

    Second moment of the gradient

    +

    Second moment of the gradient

    In stochastic gradient descent, with and without momentum, we still @@ -617,7 +672,7 @@ ADAM.











    -

    RMS prop

    +

    RMS prop

    In RMS prop, in addition to keeping a running average of the first @@ -648,7 +703,7 @@ learning rate for flat directions.











    -

    ADAM optimizer

    +

    ADAM optimizer

    A related algorithm is the ADAM optimizer. In ADAM, we keep a running @@ -697,7 +752,7 @@ $$











    -

    Practical tips

    +

    Practical tips

    • Randomize the data when making mini-batches. It is always important to randomly shuffle the data when forming mini-batches. Otherwise, the gradient descent method can fit spurious correlations resulting from the order in which data is presented.
    • @@ -711,7 +766,7 @@ Geron's text, see chapter 11, has several interesting discussions.











      -

      Automatic differentiation

      +

      Automatic differentiation

      Automatic differentiation (AD), @@ -758,7 +813,7 @@ Using autograd we have

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       
       # To do elementwise differentiation:
       from autograd import elementwise_grad as egrad 
      @@ -796,7 +851,7 @@ plt.show()
       

      -

      Using autograd

      +

      Using autograd

      Here we @@ -808,7 +863,7 @@ experiment with other, possibly more complicated, functions as well.

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       
       def f1(x):
      @@ -829,7 +884,7 @@ grad_analytical = 3*a**Autograd with more complicated functions 
      +

      Autograd with more complicated functions

      To differentiate with respect to two (or more) arguments of a Python @@ -839,7 +894,7 @@ being differentiated with respect to.

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       def f2(x1,x2):
           return 3*x1**3 + x2*(x1 - 5) + 1
      @@ -879,12 +934,12 @@ Note that the grad function will not produce the true gradient of the function.
       











      -

      More complicated functions using the elements of their arguments directly

      +

      More complicated functions using the elements of their arguments directly

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       def f3(x): # Assumes x is an array of length 5 or higher
           return 2*x[0] + 3*x[1] + 5*x[2] + 7*x[3] + 11*x[4]**2
      @@ -913,12 +968,12 @@ could expect form a gradient-evaluting function.
       

      -

      Functions using mathematical functions from Numpy

      +

      Functions using mathematical functions from Numpy

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       def f4(x):
           return np.sqrt(1+x**2) + np.exp(x) + np.sin(2*np.pi*x)
      @@ -939,12 +994,12 @@ f4_grad_analytical = x/np.sqrt(1 + x**
       









      -

      More autograd

      +

      More autograd

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       def f5(x):
           if x >= 0:
      @@ -962,12 +1017,12 @@ x = 2.7
       











      -

      And with loops

      +

      And with loops

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       def f6_for(x):
           val = 0
      @@ -995,7 +1050,7 @@ x = 0.5
       

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       # Both of the functions are implementation of the sum: sum(x**i) for i = 0, ..., 9
       # The analytical derivative is: sum(i*x**(i-1)) 
      @@ -1008,11 +1063,11 @@ f6_grad_analytical = 0
       











      -

      Using recursion

      +

      Using recursion

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       
       def f7(n): # Assume that n is an integer
      @@ -1046,7 +1101,7 @@ Note that if n is equal to zero or one, Autograd will give an error message. Thi
       











      -

      Unsupported functions

      +

      Unsupported functions

      Autograd supports many features. However, there are some functions that is not supported (yet) by Autograd.

      @@ -1054,7 +1109,7 @@ Assigning a value to the variable being differentiated with respect to

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       def f8(x): # Assume x is an array
           x[2] = 3
      @@ -1072,11 +1127,11 @@ Here, Autograd tells us that an 'ArrayBox' does not support item assignment. The
       











      -

      The syntax a.dot(b) when finding the dot product

      +

      The syntax a.dot(b) when finding the dot product

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       def f9(a): # Assume a is an array with 2 elements
           b = np.array([1.0,2.0])
      @@ -1096,7 +1151,7 @@ which also computed the dot product can be used:
       

      -

      import autograd.numpy as np
      +
      import autograd.numpy as np
       from autograd import grad
       def f9_alternative(x): # Assume a is an array with 2 elements
           b = np.array([1.0,2.0])
      @@ -1114,12 +1169,12 @@ x = np.array([3.0,Recommended to avoid 
      +
       The documentation recommends to avoid inplace operations such as
       

      -

      a += b
      +
      a += b
       a -= b
       a*= b
       a /=b
      @@ -1127,7 +1182,7 @@ a /=b
       











      -

      Neural networks

      +

      Neural networks

      Artificial neural networks are computational systems that can learn to @@ -1141,7 +1196,7 @@ a weight variable.











      -

      Artificial neurons

      +

      Artificial neurons

      The field of artificial neural networks has a long history of @@ -1204,7 +1259,7 @@ humanities to life science and medicine.











      -

      Neural network types

      +

      Neural network types

      An artificial neural network (ANN), is a computational model that @@ -1231,7 +1286,7 @@ methods we discussed earlier.











      -

      Feed-forward neural networks

      +

      Feed-forward neural networks

      The feed-forward neural network (FFNN) was the first and simplest type @@ -1249,7 +1304,7 @@ to all nodes in the subsequent layer, making this a so-called











      -

      Convolutional Neural Network

      +

      Convolutional Neural Network

      A different variant of FFNNs are convolutional neural networks @@ -1275,7 +1330,7 @@ recognition.











      -

      Recurrent neural networks

      +

      Recurrent neural networks

      So far we have only mentioned ANNs where information flows in one @@ -1292,7 +1347,7 @@ especially well-suited for handwriting and speech recognition.











      -

      Other types of networks

      +

      Other types of networks

      There are many other kinds of ANNs that have been developed. One type @@ -1309,7 +1364,7 @@ type of NN due the unusual activation functions.











      -

      Multilayer perceptrons

      +

      Multilayer perceptrons

      One uses often so-called fully-connected feed-forward neural networks @@ -1323,7 +1378,7 @@ Such networks are often called multilayer perceptrons (MLPs).











      -

      Why multilayer perceptrons?

      +

      Why multilayer perceptrons?

      According to the Universal approximation theorem, a feed-forward @@ -1341,7 +1396,7 @@ as to not restrict the range of output values.











      -

      Mathematical model

      +

      Mathematical model

      The output \( y \) is produced via the activation function \( f \) @@ -1359,7 +1414,7 @@ of the outputs of all neurons in the previous layer.











      -

      Mathematical model

      +

      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 \), @@ -1406,7 +1461,7 @@ is obtained.











      -

      Mathematical model

      +

      Mathematical model

      The output of neuron \( i \) in layer 2 is thus, @@ -1435,7 +1490,7 @@ $$











      -

      Mathematical model

      +

      Mathematical model

      We can generalize this expression to an MLP with \( l \) hidden @@ -1455,7 +1510,7 @@ variables are the input values \( x_n \).











      -

      Mathematical model

      +

      Mathematical model

      This confirms that an MLP, despite its quite convoluted mathematical @@ -1484,7 +1539,7 @@ flexibility of a neural network.











      -

      Matrix-vector notation

      +

      Matrix-vector notation

      We can introduce a more convenient notation for the activations in an A NN. @@ -1523,7 +1578,7 @@ $$











      -

      Matrix-vector notation and activation

      +

      Matrix-vector notation and activation

      The activation of node \( i \) in layer 2 is @@ -1546,7 +1601,7 @@ used as input to the activation functions. For each operation











      -

      Activation functions

      +

      Activation functions

      A property that characterizes a neural network, other than its @@ -1563,7 +1618,7 @@ for a FFNN to fulfill the universal approximation theorem









      -

      Activation functions, Logistic and Hyperbolic ones

      +

      Activation functions, Logistic and Hyperbolic ones

      The second requirement excludes all linear functions. Furthermore, in @@ -1588,7 +1643,7 @@ $$











      -

      Relevance

      +

      Relevance

      The sigmoid function are more biologically plausible because the @@ -1600,7 +1655,7 @@ become the most popular for deep neural networks

      -

      """The sigmoid function (or the logistic curve) is a 
      +
      """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."""
      @@ -1675,7 +1730,7 @@ plt.show()
       











      -

      The multilayer perceptron (MLP)

      +

      The multilayer perceptron (MLP)

      The multilayer perceptron is a very popular, and easy to implement approach, to deep learning. It consists of @@ -1713,7 +1768,7 @@ like logistic regression or linear regression and their modifications on the oth











      -

      From one to many layers, the universal approximation theorem

      +

      From one to many layers, the universal approximation theorem

      A neural network with only one layer, what we called the simple @@ -1741,7 +1796,7 @@ the potential of being universal approximators.











      -

      Deriving the back propagation code for a multilayer perceptron model

      +

      Deriving the back propagation code for a multilayer perceptron model

      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. @@ -1772,7 +1827,7 @@ classes.











      -

      Definitions

      +

      Definitions

      With our definition of the targets \( \hat{t} \), the outputs of the @@ -1810,7 +1865,7 @@ $$











      -

      Derivatives and the chain rule

      +

      Derivatives and the chain rule

      From the definition of the activation \( z_j^l \) we have @@ -1832,7 +1887,7 @@ $$











      -

      Derivative of the cost function

      +

      Derivative of the cost function

      With these definitions we can now compute the derivative of the cost function in terms of the weights. @@ -1857,7 +1912,7 @@ $$











      -

      Bringing it together, first back propagation equation

      +

      Bringing it together, first back propagation equation

      We have thus @@ -1907,7 +1962,7 @@ $$











      -

      Derivatives in terms of \( z_j^L \)

      +

      Derivatives in terms of \( z_j^L \)

      It is also easy to see that our previous equation can be written as @@ -1924,14 +1979,14 @@ $$ 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.









      -

      Bringing it together

      +

      Bringing it together

      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

      -The starting equations. +The starting equations

      $$ @@ -1985,7 +2040,7 @@ one \( L-1 \) in terms of the errors in the final output layer.











      -

      Final back propagating equation

      +

      Final back propagating equation

      We have that (replacing \( L \) with a general layer \( l \)) @@ -2017,7 +2072,7 @@ We are now ready to set up the algorithm for back propagation and learning the w











      -

      Setting up the Back propagation algorithm

      +

      Setting up the Back propagation algorithm

      The four equations provide us with a way of computing the gradient of the cost function. Let us write this out in the form of an algorithm. @@ -2091,7 +2146,7 @@ Here it is convenient to use stochastic gradient descent (see the examples below

      - © 1999-2020, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2021, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
      diff --git a/doc/pub/week40/html/week40.html b/doc/pub/week40/html/week40.html index 1a19588a1..c38588e5d 100644 --- a/doc/pub/week40/html/week40.html +++ b/doc/pub/week40/html/week40.html @@ -1,11 +1,11 @@ - + @@ -53,10 +53,10 @@ hr.figure { border: 0; width: 80%; border-bottom: 1px solid #aaa} .alert-block > p, .alert-block > ul {margin-bottom:1em} .alert li {margin-top: 1em} .alert-block p+p {margin-top:5px} -.alert-notice { background-image: url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_gray_notice.png); } -.alert-summary { background-image:url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_gray_summary.png); } -.alert-warning { background-image: url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_gray_warning.png); } -.alert-question {background-image:url(https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_images/small_gray_question.png); } +.alert-notice { background-image: url(https://cdn.rawgit.com/doconce/doconce/master/bundled/html_images/small_gray_notice.png); } +.alert-summary { background-image:url(https://cdn.rawgit.com/doconce/doconce/master/bundled/html_images/small_gray_summary.png); } +.alert-warning { background-image: url(https://cdn.rawgit.com/doconce/doconce/master/bundled/html_images/small_gray_warning.png); } +.alert-question {background-image:url(https://cdn.rawgit.com/doconce/doconce/master/bundled/html_images/small_gray_question.png); } div { text-align: justify; text-justify: inter-word; } @@ -66,90 +66,144 @@ div { text-align: justify; text-justify: inter-word; } @@ -187,29 +241,30 @@ MathJax.Hub.Config({

      -

      [1] Department of Physics, University of Oslo
      -
      [2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University
      +
      [1] Department of Physics, University of Oslo, Norway
      +
      [2] Department of Physics and Astronomy and Facility for Rare Ion Beams, Michigan State University, USA

      -

      Oct 6, 2020

      +

      Oct 4, 2021












      -

      Plan for week 40

      +

      Plan for week 40

        -
      • Thursday: Stochastic Gradient descent with examples and automatic differentiation and begin Neural Networks. Video of Lecture
      • -
      • Friday: Neural Networks, setting up the basic steps, from the simple perceptron model to the multi-layer perceptron model. Video of Lecture
      • +
      • Thursday: Stochastic Gradient descent with examples and automatic differentiation and begin Neural Networks.
      • +
      • Friday: Neural Networks, setting up the basic steps, from the simple perceptron model to the multi-layer perceptron model.
      Reading suggestions for both days: Aurelien Geron's chapter 10 and Hastie et al chapter 11. For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text. +For neural networks we recommend Goodfellow et al chapters 6 and 7 and Bishop 5.1-5.4











      -

      Overview video for week 40

      +

      Overview video for week 40

      Overview Video, from Stochastic Gradient methods to Neural Networks @@ -217,7 +272,7 @@ For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text.











      -

      Stochastic Gradient Descent

      +

      Stochastic Gradient Descent

      Stochastic gradient descent (SGD) and variants thereof address some of @@ -235,7 +290,7 @@ $$











      -

      Computation of gradients

      +

      Computation of gradients

      This in turn means that the gradient can be @@ -255,7 +310,7 @@ minibatches. We denote these minibatches by \( B_k \) where











      -

      SGD example

      +

      SGD example

      As an example, suppose we have \( 10 \) data points \( (\mathbf{x}_1,\cdots, \mathbf{x}_{10}) \) and we choose to have \( M=5 \) minibathces, then each minibatch contains two data points. In particular we have @@ -279,7 +334,7 @@ $$











      -

      The gradient step

      +

      The gradient step

      Thus a gradient descent step now looks like @@ -298,12 +353,12 @@ the number of minibatches, as exemplified in the code below.











      -

      Simple example code

      +

      Simple example code

      -

      import numpy as np 
      +
      import numpy as np 
       
       n = 100 #100 datapoints 
       M = 5   #size of each minibatch
      @@ -330,7 +385,7 @@ all \( n \) datapoints.
       











      -

      When do we stop?

      +

      When do we stop?

      A natural question is when do we stop the search for a new minimum? @@ -347,7 +402,7 @@ gave the lowest value.











      -

      Slightly different approach

      +

      Slightly different approach

      Another approach is to let the step length \( \gamma_j \) depend on the @@ -367,7 +422,7 @@ function.

      -

      import numpy as np 
      +
      import numpy as np 
       
       def step_length(t,t0,t1):
           return t0/(t+t1)
      @@ -395,12 +450,12 @@ j = 0
       











      -

      Program for stochastic gradient

      +

      Program for stochastic gradient

      -

      # Importing various packages
      +
      # Importing various packages
       from math import exp, sqrt
       from random import random, seed
       import numpy as np
      @@ -471,7 +526,7 @@ plt.show()
       











      -

      Momentum based GD

      +

      Momentum based GD

      The stochastic gradient descent (SGD) is almost always used with a @@ -508,7 +563,7 @@ where we have defined \( \Delta \boldsymbol{\theta}_{t}= \boldsymbol{\theta}_t-\











      -

      More on momentum based approaches

      +

      More on momentum based approaches

      Let us try to get more intuition from these equations. It is helpful @@ -538,7 +593,7 @@ $$











      -

      Momentum parameter

      +

      Momentum parameter

      Notice that this equation is identical to previous one if we identify @@ -594,7 +649,7 @@ One of the major advantages of NAG is that it allows for the use of a larger lea











      -

      Second moment of the gradient

      +

      Second moment of the gradient

      In stochastic gradient descent, with and without momentum, we still @@ -622,7 +677,7 @@ ADAM.











      -

      RMS prop

      +

      RMS prop

      In RMS prop, in addition to keeping a running average of the first @@ -653,7 +708,7 @@ learning rate for flat directions.











      -

      ADAM optimizer

      +

      ADAM optimizer

      A related algorithm is the ADAM optimizer. In ADAM, we keep a running @@ -702,7 +757,7 @@ $$











      -

      Practical tips

      +

      Practical tips

      • Randomize the data when making mini-batches. It is always important to randomly shuffle the data when forming mini-batches. Otherwise, the gradient descent method can fit spurious correlations resulting from the order in which data is presented.
      • @@ -716,7 +771,7 @@ Geron's text, see chapter 11, has several interesting discussions.











        -

        Automatic differentiation

        +

        Automatic differentiation

        Automatic differentiation (AD), @@ -763,7 +818,7 @@ Using autograd we have

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         
         # To do elementwise differentiation:
         from autograd import elementwise_grad as egrad 
        @@ -801,7 +856,7 @@ plt.show()
         

        -

        Using autograd

        +

        Using autograd

        Here we @@ -813,7 +868,7 @@ experiment with other, possibly more complicated, functions as well.

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         
         def f1(x):
        @@ -834,7 +889,7 @@ grad_analytical = Autograd with more complicated functions 
        +

        Autograd with more complicated functions

        To differentiate with respect to two (or more) arguments of a Python @@ -844,7 +899,7 @@ being differentiated with respect to.

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         def f2(x1,x2):
             return 3*x1**3 + x2*(x1 - 5) + 1
        @@ -884,12 +939,12 @@ Note that the grad function will not produce the true gradient of the function.
         











        -

        More complicated functions using the elements of their arguments directly

        +

        More complicated functions using the elements of their arguments directly

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         def f3(x): # Assumes x is an array of length 5 or higher
             return 2*x[0] + 3*x[1] + 5*x[2] + 7*x[3] + 11*x[4]**2
        @@ -918,12 +973,12 @@ could expect form a gradient-evaluting function.
         

        -

        Functions using mathematical functions from Numpy

        +

        Functions using mathematical functions from Numpy

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         def f4(x):
             return np.sqrt(1+x**2) + np.exp(x) + np.sin(2*np.pi*x)
        @@ -944,12 +999,12 @@ f4_grad_analytical = xMore autograd 
        +

        More autograd

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         def f5(x):
             if x >= 0:
        @@ -967,12 +1022,12 @@ x = 2.7
         











        -

        And with loops

        +

        And with loops

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         def f6_for(x):
             val = 0
        @@ -1000,7 +1055,7 @@ x = 0.5
         

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         # Both of the functions are implementation of the sum: sum(x**i) for i = 0, ..., 9
         # The analytical derivative is: sum(i*x**(i-1)) 
        @@ -1013,11 +1068,11 @@ f6_grad_analytical = Using recursion 
        +

        Using recursion

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         
         def f7(n): # Assume that n is an integer
        @@ -1051,7 +1106,7 @@ Note that if n is equal to zero or one, Autograd will give an error message. Thi
         











        -

        Unsupported functions

        +

        Unsupported functions

        Autograd supports many features. However, there are some functions that is not supported (yet) by Autograd.

        @@ -1059,7 +1114,7 @@ Assigning a value to the variable being differentiated with respect to

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         def f8(x): # Assume x is an array
             x[2] = 3
        @@ -1077,11 +1132,11 @@ Here, Autograd tells us that an 'ArrayBox' does not support item assignment. The
         











        -

        The syntax a.dot(b) when finding the dot product

        +

        The syntax a.dot(b) when finding the dot product

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         def f9(a): # Assume a is an array with 2 elements
             b = np.array([1.0,2.0])
        @@ -1101,7 +1156,7 @@ which also computed the dot product can be used:
         

        -

        import autograd.numpy as np
        +
        import autograd.numpy as np
         from autograd import grad
         def f9_alternative(x): # Assume a is an array with 2 elements
             b = np.array([1.0,2.0])
        @@ -1119,12 +1174,12 @@ x = np.a
         











        -

        Recommended to avoid

        + The documentation recommends to avoid inplace operations such as

        -

        a += b
        +
        a += b
         a -= b
         a*= b
         a /=b
        @@ -1132,7 +1187,7 @@ a /=b
         











        -

        Neural networks

        +

        Neural networks

        Artificial neural networks are computational systems that can learn to @@ -1146,7 +1201,7 @@ a weight variable.











        -

        Artificial neurons

        +

        Artificial neurons

        The field of artificial neural networks has a long history of @@ -1209,7 +1264,7 @@ humanities to life science and medicine.











        -

        Neural network types

        +

        Neural network types

        An artificial neural network (ANN), is a computational model that @@ -1236,7 +1291,7 @@ methods we discussed earlier.











        -

        Feed-forward neural networks

        +

        Feed-forward neural networks

        The feed-forward neural network (FFNN) was the first and simplest type @@ -1254,7 +1309,7 @@ to all nodes in the subsequent layer, making this a so-called











        -

        Convolutional Neural Network

        +

        Convolutional Neural Network

        A different variant of FFNNs are convolutional neural networks @@ -1280,7 +1335,7 @@ recognition.











        -

        Recurrent neural networks

        +

        Recurrent neural networks

        So far we have only mentioned ANNs where information flows in one @@ -1297,7 +1352,7 @@ especially well-suited for handwriting and speech recognition.











        -

        Other types of networks

        +

        Other types of networks

        There are many other kinds of ANNs that have been developed. One type @@ -1314,7 +1369,7 @@ type of NN due the unusual activation functions.











        -

        Multilayer perceptrons

        +

        Multilayer perceptrons

        One uses often so-called fully-connected feed-forward neural networks @@ -1328,7 +1383,7 @@ Such networks are often called multilayer perceptrons (MLPs).











        -

        Why multilayer perceptrons?

        +

        Why multilayer perceptrons?

        According to the Universal approximation theorem, a feed-forward @@ -1346,7 +1401,7 @@ as to not restrict the range of output values.











        -

        Mathematical model

        +

        Mathematical model

        The output \( y \) is produced via the activation function \( f \) @@ -1364,7 +1419,7 @@ of the outputs of all neurons in the previous layer.











        -

        Mathematical model

        +

        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 \), @@ -1411,7 +1466,7 @@ is obtained.











        -

        Mathematical model

        +

        Mathematical model

        The output of neuron \( i \) in layer 2 is thus, @@ -1440,7 +1495,7 @@ $$











        -

        Mathematical model

        +

        Mathematical model

        We can generalize this expression to an MLP with \( l \) hidden @@ -1460,7 +1515,7 @@ variables are the input values \( x_n \).











        -

        Mathematical model

        +

        Mathematical model

        This confirms that an MLP, despite its quite convoluted mathematical @@ -1489,7 +1544,7 @@ flexibility of a neural network.











        -

        Matrix-vector notation

        +

        Matrix-vector notation

        We can introduce a more convenient notation for the activations in an A NN. @@ -1528,7 +1583,7 @@ $$











        -

        Matrix-vector notation and activation

        +

        Matrix-vector notation and activation

        The activation of node \( i \) in layer 2 is @@ -1551,7 +1606,7 @@ used as input to the activation functions. For each operation











        -

        Activation functions

        +

        Activation functions

        A property that characterizes a neural network, other than its @@ -1568,7 +1623,7 @@ for a FFNN to fulfill the universal approximation theorem









        -

        Activation functions, Logistic and Hyperbolic ones

        +

        Activation functions, Logistic and Hyperbolic ones

        The second requirement excludes all linear functions. Furthermore, in @@ -1593,7 +1648,7 @@ $$











        -

        Relevance

        +

        Relevance

        The sigmoid function are more biologically plausible because the @@ -1605,7 +1660,7 @@ become the most popular for deep neural networks

        -

        """The sigmoid function (or the logistic curve) is a 
        +
        """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."""
        @@ -1680,7 +1735,7 @@ plt.show()
         











        -

        The multilayer perceptron (MLP)

        +

        The multilayer perceptron (MLP)

        The multilayer perceptron is a very popular, and easy to implement approach, to deep learning. It consists of @@ -1718,7 +1773,7 @@ like logistic regression or linear regression and their modifications on the oth











        -

        From one to many layers, the universal approximation theorem

        +

        From one to many layers, the universal approximation theorem

        A neural network with only one layer, what we called the simple @@ -1746,7 +1801,7 @@ the potential of being universal approximators.











        -

        Deriving the back propagation code for a multilayer perceptron model

        +

        Deriving the back propagation code for a multilayer perceptron model

        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. @@ -1777,7 +1832,7 @@ classes.











        -

        Definitions

        +

        Definitions

        With our definition of the targets \( \hat{t} \), the outputs of the @@ -1815,7 +1870,7 @@ $$











        -

        Derivatives and the chain rule

        +

        Derivatives and the chain rule

        From the definition of the activation \( z_j^l \) we have @@ -1837,7 +1892,7 @@ $$











        -

        Derivative of the cost function

        +

        Derivative of the cost function

        With these definitions we can now compute the derivative of the cost function in terms of the weights. @@ -1862,7 +1917,7 @@ $$











        -

        Bringing it together, first back propagation equation

        +

        Bringing it together, first back propagation equation

        We have thus @@ -1912,7 +1967,7 @@ $$











        -

        Derivatives in terms of \( z_j^L \)

        +

        Derivatives in terms of \( z_j^L \)

        It is also easy to see that our previous equation can be written as @@ -1929,14 +1984,14 @@ $$ 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.









        -

        Bringing it together

        +

        Bringing it together

        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

        -The starting equations. +The starting equations

        $$ @@ -1990,7 +2045,7 @@ one \( L-1 \) in terms of the errors in the final output layer.











        -

        Final back propagating equation

        +

        Final back propagating equation

        We have that (replacing \( L \) with a general layer \( l \)) @@ -2022,7 +2077,7 @@ We are now ready to set up the algorithm for back propagation and learning the w











        -

        Setting up the Back propagation algorithm

        +

        Setting up the Back propagation algorithm

        The four equations provide us with a way of computing the gradient of the cost function. Let us write this out in the form of an algorithm. @@ -2096,7 +2151,7 @@ Here it is convenient to use stochastic gradient descent (see the examples below

        - © 1999-2020, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license + © 1999-2021, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
        diff --git a/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz b/doc/pub/week40/ipynb/ipynb-week40-src.tar.gz index 0cbeb59bd..d20d7891f 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 f10b3bc9d..f69abd070 100644 --- a/doc/pub/week40/ipynb/week40.ipynb +++ b/doc/pub/week40/ipynb/week40.ipynb @@ -6,25 +6,26 @@ "source": [ "\n", "# Week 40: From Stochastic Gradient Descent to Neural networks\n", - "\n", + "\n", " \n", - "**Morten Hjorth-Jensen**, Department of Physics, University of Oslo and Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University\n", + "**Morten Hjorth-Jensen**, Department of Physics, University of Oslo, Norway and Department of Physics and Astronomy and Facility for Rare Ion Beams, Michigan State University, USA\n", "\n", - "Date: **Oct 6, 2020**\n", + "Date: **Oct 4, 2021**\n", "\n", - "Copyright 1999-2020, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n", + "Copyright 1999-2021, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n", "\n", "\n", "\n", "\n", "## Plan for week 40\n", "\n", - "* Thursday: Stochastic Gradient descent with examples and automatic differentiation and begin Neural Networks. [Video of Lecture](https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h20/forelesningsvideoer/LectureOctober1.mp4?vrtx=view-as-webpage) \n", + "* Thursday: Stochastic Gradient descent with examples and automatic differentiation and begin Neural Networks. \n", "\n", - "* Friday: Neural Networks, setting up the basic steps, from the simple perceptron model to the multi-layer perceptron model. [Video of Lecture](https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h20/forelesningsvideoer/LectureOctober2.mp4?vrtx=view-as-webpage) \n", + "* Friday: Neural Networks, setting up the basic steps, from the simple perceptron model to the multi-layer perceptron model. \n", "\n", "Reading suggestions for both days: [Aurelien Geron's chapter 10](https://github.com/CompPhysics/MachineLearning/blob/master/doc/Textbooks/TensorflowML.pdf) and Hastie et al chapter 11.\n", - "For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text. \n", + "For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text.\n", + "For neural networks we recommend Goodfellow et al chapters 6 and 7 and Bishop 5.1-5.4\n", "\n", "## Overview video for week 40\n", "\n", @@ -141,8 +142,11 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": {}, + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "import numpy as np \n", @@ -203,8 +207,11 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": {}, + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "import numpy as np \n", @@ -242,8 +249,11 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "%matplotlib inline\n", @@ -797,29 +807,12 @@ }, { "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAdwAAAEWCAYAAADM0CYnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nOzdd3gU5drH8e+dRggJIZDQO9IhBAgCFrBgwQIqFhQFK3oU22s9eGzn2PUcu6Ji7wqiICqKCjZaAknovYVQQmihhJDkef+YAdeYTrLPlvtzXbmyuzM7+5tnZ5972u6IMQallFJK1awQ2wGUUkqpYKAFVymllPICLbhKKaWUF2jBVUoppbxAC65SSinlBVpwlVJKKS+wUnBF5EQRWV5D0x4rIuNrYtqBTkTeEZFHyhj+iIhsF5Et3swViETkJBHJtJ3DJhExInLMUU5jsYicVMbwGSJy7VFM/yER+aCqz/eWo2lLEflWREYd5etfKSK/VWL8dSIyqIqv1VJE9opIaFWeX860R4jI99U93cPKLbhuwxwQkVwR2SUif4jI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IDBFJFZGRXktXMyoyzy8BnYEsYCFwqzGmyDvxrAm0/ssqvR7u0ZESHiv+PauKjONPKjw/InIyTsE9oUYT1byKzPNzwD3GmEJnA8ivVWR+w4DewKlAbWCWiMw2xqyo6XA1pCLzfAaQBpwCtAN+EJFfjTF7ajqcRYHWf1mlBffoZAItPO43x1n7rew4/qRC8yMiicB4YLAxJsdL2WpKReY5GfjELbbxwFkiUmCM+dI7EatVRZfr7caYfcA+EfkF6AH4a8GtyDxfBTxhnIObq0RkLdAJmOudiFYEWv9lle5SPjrzgPYi0kZEIoDhwORi40wGRrpn+/UDdhtjNns7aDUqd55FpCXwBXCFH2/xeCp3no0xbYwxrY0xrYEJwI1+WmyhYsv1V8CJIhImIlFAX2Cpl3NWp4rM8wacLXpEpBHQEVjj1ZTeF2j9l1W6hXsUjDEFIjIGmIZzluNbxpjFInKDO3wczhmrZwGrgP04a8l+q4Lz/ADQAHjF3eIrMH581ZEKznPAqMj8GmOWish3QAZQBIw3xpT41RJ/UMH3+D/AOyKyEGdX6z3GGL++ZJ+IfAycBMSLSCbwIBAOgdl/2aY/7aiUUkp5ge5SVkoppbxAC65SSinlBVpwlVJKKS/QgquUUkp5gRZcpZRSygu04CqllFJeoAVXKaWU8gItuEr5Efd6uxkiEikiddzrsnaznUspVT794Qul/IyIPAJE4lw0INMY87jlSOr/27tDHAWCIAyjfwW9BofkGsg9CCfgXATNAZAYLoTZ1IpBk1E96eS9E5T7Uj3JFKwguDCZz79+X0neSU7d/bfxSMAKnpRhPvssB9B/smy6wARsuDCZqronuSU5Jjl092XjkYAVXAuCiVTVOcv1pWtV7ZI8q+q3ux9bzwZ8Z8MFgAF8wwWAAQQXAAYQXAAYQHABYADBBYABBBcABhBcABjgH5eG7m80XrSRAAAAAElFTkSuQmCC\n", - "text/plain": [ - "
        " - ] - }, - "metadata": { - "needs_background": "light" - }, - "output_type": "display_data" - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The max absolute difference is: 1.77636e-15\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "\n", @@ -873,18 +866,12 @@ }, { "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The gradient of f1 evaluated at a = 1 using autograd is: 3\n", - "The gradient of f1 evaluated at a = 1 by finding the analytic expression is: 3\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -918,23 +905,12 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Evaluating at x1 = 1, x2 = 3\n", - "------------------------------\n", - "The derivative of f2 w.r.t x1: 12\n", - "The analytical derivative of f2 w.r.t x1: 12\n", - "\n", - "The derivative of f2 w.r.t x2: -4\n", - "The analytical derivative of f2 w.r.t x2: -4\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -983,18 +959,12 @@ }, { "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The computed gradient of f3 is: [ 2. 3. 5. 7. 88.]\n", - "The analytical gradient of f3 is: [ 2. 3. 5. 7. 88.]\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -1032,18 +1002,12 @@ }, { "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The computed derivative of f4 at x = 2.7 is: 13.8759\n", - "The analytical gradient of f4 at x = 2.7 is: 13.8759\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -1073,17 +1037,12 @@ }, { "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The computed derivative of f5 at x = 2.7 is: 5.4\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -1140,17 +1099,12 @@ }, { "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The analytical derivative of f6 at x = 2.7 is: 37732.5\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -1172,18 +1126,12 @@ }, { "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The computed derivative of f7 at n = 2 is: 1\n", - "The analytical derivative of f7 at n = 2 is: 1\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -1228,27 +1176,12 @@ }, { "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'ArrayBox' object does not support item assignment", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m8.4\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"The derivative of f8 is:\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mf8_grad\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/wrap_util.py\u001b[0m in \u001b[0;36mnary_f\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtuple\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0margnum\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 20\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0munary_operator\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0munary_f\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mnary_op_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mnary_op_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 21\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnary_f\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnary_operator\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/differential_operators.py\u001b[0m in \u001b[0;36mgrad\u001b[0;34m(fun, x)\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0marguments\u001b[0m \u001b[0;32mas\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m`\u001b[0m\u001b[0mfun\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbut\u001b[0m \u001b[0mreturns\u001b[0m \u001b[0mthe\u001b[0m \u001b[0mgradient\u001b[0m \u001b[0minstead\u001b[0m\u001b[0;34m.\u001b[0m \u001b[0mThe\u001b[0m \u001b[0mfunction\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m`\u001b[0m\u001b[0mfun\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 24\u001b[0m should be scalar-valued. The gradient has the same type as the argument.\"\"\"\n\u001b[0;32m---> 25\u001b[0;31m \u001b[0mvjp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mans\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_make_vjp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfun\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 26\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mvspace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mans\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msize\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 27\u001b[0m raise TypeError(\"Grad only applies to real scalar-output functions. \"\n", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/core.py\u001b[0m in \u001b[0;36mmake_vjp\u001b[0;34m(fun, x)\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmake_vjp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfun\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mstart_node\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mVJPNode\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnew_root\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mend_value\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend_node\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtrace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart_node\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfun\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mend_node\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvjp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mvspace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzeros\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/tracer.py\u001b[0m in \u001b[0;36mtrace\u001b[0;34m(start_node, fun, x)\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mtrace_stack\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnew_trace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mstart_box\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnew_box\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstart_node\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mend_box\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart_box\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misbox\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mend_box\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mend_box\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_trace\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mstart_box\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_trace\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mend_box\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_value\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend_box\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_node\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/wrap_util.py\u001b[0m in \u001b[0;36munary_f\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0msubargs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msubvals\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mzip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margnum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0msubargs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 16\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margnum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0margnum\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36mf8\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mautograd\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mgrad\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mf8\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# Assume x is an array\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mx\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m3\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 5\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mTypeError\u001b[0m: 'ArrayBox' object does not support item assignment" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -1274,27 +1207,12 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "ename": "AttributeError", - "evalue": "'ArrayBox' object has no attribute 'dot'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m0.0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 11\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"The derivative of f9 is:\"\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mf9_grad\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/wrap_util.py\u001b[0m in \u001b[0;36mnary_f\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtuple\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\u001b[0m \u001b[0;32min\u001b[0m \u001b[0margnum\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 20\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0munary_operator\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0munary_f\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mnary_op_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mnary_op_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 21\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnary_f\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 22\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnary_operator\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/differential_operators.py\u001b[0m in \u001b[0;36mgrad\u001b[0;34m(fun, x)\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[0marguments\u001b[0m \u001b[0;32mas\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m`\u001b[0m\u001b[0mfun\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbut\u001b[0m \u001b[0mreturns\u001b[0m \u001b[0mthe\u001b[0m \u001b[0mgradient\u001b[0m \u001b[0minstead\u001b[0m\u001b[0;34m.\u001b[0m \u001b[0mThe\u001b[0m \u001b[0mfunction\u001b[0m\u001b[0;31m \u001b[0m\u001b[0;31m`\u001b[0m\u001b[0mfun\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 24\u001b[0m should be scalar-valued. The gradient has the same type as the argument.\"\"\"\n\u001b[0;32m---> 25\u001b[0;31m \u001b[0mvjp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mans\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_make_vjp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfun\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 26\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mvspace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mans\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msize\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 27\u001b[0m raise TypeError(\"Grad only applies to real scalar-output functions. \"\n", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/core.py\u001b[0m in \u001b[0;36mmake_vjp\u001b[0;34m(fun, x)\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mmake_vjp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfun\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mstart_node\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mVJPNode\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnew_root\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mend_value\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend_node\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtrace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart_node\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfun\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mend_node\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvjp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mvspace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mzeros\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/tracer.py\u001b[0m in \u001b[0;36mtrace\u001b[0;34m(start_node, fun, x)\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0mtrace_stack\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnew_trace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mstart_box\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnew_box\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstart_node\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m \u001b[0mend_box\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart_box\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misbox\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mend_box\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mend_box\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_trace\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mstart_box\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_trace\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mend_box\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_value\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend_box\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_node\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m~/anaconda3/lib/python3.6/site-packages/autograd/wrap_util.py\u001b[0m in \u001b[0;36munary_f\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0msubargs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msubvals\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mzip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margnum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfun\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0msubargs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 16\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margnum\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0margnum\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36mf9\u001b[0;34m(a)\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mf9\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# Assume a is an array with 2 elements\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mb\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1.0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m2.0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0mf9_grad\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgrad\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf9\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAttributeError\u001b[0m: 'ArrayBox' object has no attribute 'dot'" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -1320,17 +1238,12 @@ }, { "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "The gradient of f9 is: [1. 2.]\n" - ] - } - ], + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, + "outputs": [], "source": [ "import autograd.numpy as np\n", "from autograd import grad\n", @@ -1358,8 +1271,11 @@ }, { "cell_type": "code", - "execution_count": 15, - "metadata": {}, + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "a += b\n", @@ -1951,8 +1867,11 @@ }, { "cell_type": "code", - "execution_count": 16, - "metadata": {}, + "execution_count": null, + "metadata": { + "collapsed": false, + "editable": true + }, "outputs": [], "source": [ "\"\"\"The sigmoid function (or the logistic curve) is a \n", @@ -2660,25 +2579,7 @@ ] } ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.6.8" - } - }, + "metadata": {}, "nbformat": 4, "nbformat_minor": 4 } diff --git a/doc/src/week40/week40.do.txt b/doc/src/week40/week40.do.txt index 45ddcb73b..9e709af69 100644 --- a/doc/src/week40/week40.do.txt +++ b/doc/src/week40/week40.do.txt @@ -1,16 +1,17 @@ TITLE: Week 40: From Stochastic Gradient Descent to Neural networks -AUTHOR: Morten Hjorth-Jensen {copyright, 1999-present|CC BY-NC} at Department of Physics, University of Oslo & Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University +AUTHOR: Morten Hjorth-Jensen {copyright, 1999-present|CC BY-NC} at Department of Physics, University of Oslo, Norway & Department of Physics and Astronomy and Facility for Rare Ion Beams, Michigan State University, USA DATE: today !split ===== Plan for week 40 ===== -* Thursday: Stochastic Gradient descent with examples and automatic differentiation and begin Neural Networks. "Video of Lecture":"https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h20/forelesningsvideoer/LectureOctober1.mp4?vrtx=view-as-webpage" -* Friday: Neural Networks, setting up the basic steps, from the simple perceptron model to the multi-layer perceptron model. "Video of Lecture":"https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h20/forelesningsvideoer/LectureOctober2.mp4?vrtx=view-as-webpage" +* Thursday: Stochastic Gradient descent with examples and automatic differentiation and begin Neural Networks. +* Friday: Neural Networks, setting up the basic steps, from the simple perceptron model to the multi-layer perceptron model. Reading suggestions for both days: "Aurelien Geron's chapter 10":"https://github.com/CompPhysics/MachineLearning/blob/master/doc/Textbooks/TensorflowML.pdf" and Hastie et al chapter 11. -For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text. +For Stochastic Gradient Descent, we recommend chapter 4 of Geron's text. +For neural networks we recommend Goodfellow et al chapters 6 and 7 and Bishop 5.1-5.4 !split ===== Overview video for week 40 ===== @@ -1721,3 +1722,4 @@ The parameter $\eta$ is the learning parameter discussed in connection with the Here it is convenient to use stochastic gradient descent (see the examples below) with mini-batches with an outer loop that steps through multiple epochs of training. +