Skip to content

Commit

Permalink
W1d2 postfixes (#531)
Browse files Browse the repository at this point in the history
* minor fixes text

* minor fix in latex

* minor fix

* minor fixes

* minor fixes

* Process tutorial notebooks

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
spirosChv and actions-user committed Dec 24, 2021
1 parent fd7fea1 commit 1091287
Show file tree
Hide file tree
Showing 12 changed files with 192 additions and 146 deletions.
31 changes: 18 additions & 13 deletions tutorials/W1D1_BasicsAndPytorch/W1D1_Tutorial1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,13 @@
"$B:$ a tensor with elements equal to the elements of numpy array $Z$\n",
"\n",
"$C:$ a tensor with the same number of elements as $A$ but with values $\n",
"\\sim U(0,1)$\n",
"\\sim \\mathcal{U}(0,1)^\\dagger$\n",
"\n",
"$D:$ a 1D tensor containing the even numbers between 4 and 40 inclusive.\n"
"$D:$ a 1D tensor containing the even numbers between 4 and 40 inclusive.\n",
"\n",
"<br>\n",
"\n",
"$^\\dagger$: $\\mathcal{U(\\alpha, \\beta)}$ denotes the [uniform distribution](https://en.wikipedia.org/wiki/Continuous_uniform_distribution) from $\\alpha$ to $\\beta$, with $\\alpha, \\beta \\in \\mathbb{R}$.\n"
]
},
{
Expand Down Expand Up @@ -2945,24 +2949,25 @@
"\n",
"PyTorch provides a base class for all neural network modules called [`nn.Module`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html). You need to inherit from `nn.Module` and implement some important methods:\n",
"\n",
"`__init__`\n",
"* `__init__`\n",
"\n",
"In the `__init__` method you need to define the structure of your network. Here you will specify what layers will the network consist of, what activation functions will be used etc.\n",
" In the `__init__` method you need to define the structure of your network. Here you will specify what layers will the network consist of, what activation functions will be used etc.\n",
"\n",
"`forward`\n",
"* `forward`\n",
"\n",
"All neural network modules need to implement the `forward` method. It specifies the computations the network needs to do when data is passed through it.\n",
" All neural network modules need to implement the `forward` method. It specifies the computations the network needs to do when data is passed through it.\n",
"\n",
"`predict`\n",
"* `predict`\n",
"\n",
"This is not an obligatory method of a neural network module, but it is a good practice if you want to quickly get the most likely label from the network. It calls the `forward` method and chooses the label with the highest score.\n",
" This is not an obligatory method of a neural network module, but it is a good practice if you want to quickly get the most likely label from the network. It calls the `forward` method and chooses the label with the highest score.\n",
"\n",
"`train`\n",
"* `train`\n",
"\n",
"This is also not an obligatory method, but it is a good practice to have. The method will be used to train the network parameters and will be implemented later in the notebook.\n",
" This is also not an obligatory method, but it is a good practice to have. The method will be used to train the network parameters and will be implemented later in the notebook.\n",
"\n",
"<br>\n",
"\n",
"> Note that you can use the `__call__` method of a module directly and it will invoke the `forward` method: `net()` does the same as `net.forward()`."
"**Note:** You can use the `__call__` method of a module directly and it will invoke the `forward` method: `net()` does the same as `net.forward()`."
]
},
{
Expand Down Expand Up @@ -3310,7 +3315,7 @@
"outputs": [],
"source": [
"# @title Visualize the training process\n",
"# @markdown ### Execute this cell!\n",
"# @markdown Execute this cell!\n",
"!pip install imageio --quiet\n",
"!pip install pathlib --quiet\n",
"\n",
Expand Down Expand Up @@ -3487,7 +3492,7 @@
},
"outputs": [],
"source": [
"# @markdown ###Play with the parameters to solve XOR\n",
"# @markdown Play with the parameters to solve XOR\n",
"from IPython.display import IFrame\n",
"IFrame(\"https://playground.arashash.com/#activation=relu&batchSize=10&dataset=xor&regDataset=reg-plane&learningRate=0.03&regularizationRate=0&noise=0&networkShape=&seed=0.91390&showTestData=false&discretize=false&percTrainData=90&x=true&y=true&xTimesY=false&xSquared=false&ySquared=false&cosX=false&sinX=false&cosY=false&sinY=false&collectStats=false&problem=classification&initZero=false&hideText=false\", width=1020, height=660)"
]
Expand Down
31 changes: 18 additions & 13 deletions tutorials/W1D1_BasicsAndPytorch/student/W1D1_Tutorial1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,13 @@
"$B:$ a tensor with elements equal to the elements of numpy array $Z$\n",
"\n",
"$C:$ a tensor with the same number of elements as $A$ but with values $\n",
"\\sim U(0,1)$\n",
"\\sim \\mathcal{U}(0,1)^\\dagger$\n",
"\n",
"$D:$ a 1D tensor containing the even numbers between 4 and 40 inclusive.\n"
"$D:$ a 1D tensor containing the even numbers between 4 and 40 inclusive.\n",
"\n",
"<br>\n",
"\n",
"$^\\dagger$: $\\mathcal{U(\\alpha, \\beta)}$ denotes the [uniform distribution](https://en.wikipedia.org/wiki/Continuous_uniform_distribution) from $\\alpha$ to $\\beta$, with $\\alpha, \\beta \\in \\mathbb{R}$.\n"
]
},
{
Expand Down Expand Up @@ -2756,24 +2760,25 @@
"\n",
"PyTorch provides a base class for all neural network modules called [`nn.Module`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html). You need to inherit from `nn.Module` and implement some important methods:\n",
"\n",
"`__init__`\n",
"* `__init__`\n",
"\n",
"In the `__init__` method you need to define the structure of your network. Here you will specify what layers will the network consist of, what activation functions will be used etc.\n",
" In the `__init__` method you need to define the structure of your network. Here you will specify what layers will the network consist of, what activation functions will be used etc.\n",
"\n",
"`forward`\n",
"* `forward`\n",
"\n",
"All neural network modules need to implement the `forward` method. It specifies the computations the network needs to do when data is passed through it.\n",
" All neural network modules need to implement the `forward` method. It specifies the computations the network needs to do when data is passed through it.\n",
"\n",
"`predict`\n",
"* `predict`\n",
"\n",
"This is not an obligatory method of a neural network module, but it is a good practice if you want to quickly get the most likely label from the network. It calls the `forward` method and chooses the label with the highest score.\n",
" This is not an obligatory method of a neural network module, but it is a good practice if you want to quickly get the most likely label from the network. It calls the `forward` method and chooses the label with the highest score.\n",
"\n",
"`train`\n",
"* `train`\n",
"\n",
"This is also not an obligatory method, but it is a good practice to have. The method will be used to train the network parameters and will be implemented later in the notebook.\n",
" This is also not an obligatory method, but it is a good practice to have. The method will be used to train the network parameters and will be implemented later in the notebook.\n",
"\n",
"<br>\n",
"\n",
"> Note that you can use the `__call__` method of a module directly and it will invoke the `forward` method: `net()` does the same as `net.forward()`."
"**Note:** You can use the `__call__` method of a module directly and it will invoke the `forward` method: `net()` does the same as `net.forward()`."
]
},
{
Expand Down Expand Up @@ -3110,7 +3115,7 @@
"outputs": [],
"source": [
"# @title Visualize the training process\n",
"# @markdown ### Execute this cell!\n",
"# @markdown Execute this cell!\n",
"!pip install imageio --quiet\n",
"!pip install pathlib --quiet\n",
"\n",
Expand Down Expand Up @@ -3287,7 +3292,7 @@
},
"outputs": [],
"source": [
"# @markdown ###Play with the parameters to solve XOR\n",
"# @markdown Play with the parameters to solve XOR\n",
"from IPython.display import IFrame\n",
"IFrame(\"https://playground.arashash.com/#activation=relu&batchSize=10&dataset=xor&regDataset=reg-plane&learningRate=0.03&regularizationRate=0&noise=0&networkShape=&seed=0.91390&showTestData=false&discretize=false&percTrainData=90&x=true&y=true&xTimesY=false&xSquared=false&ySquared=false&cosX=false&sinX=false&cosY=false&sinY=false&collectStats=false&problem=classification&initZero=false&hideText=false\", width=1020, height=660)"
]
Expand Down

0 comments on commit 1091287

Please sign in to comment.