commit
d988e730fc
|
|
@ -708,7 +708,7 @@
|
||||||
"source": [
|
"source": [
|
||||||
"To compute $\\partial\\mathcal{L}/\\partial W$ we can use the **chaining rule** for computing derivatives of a composite function, as you can see in the formulae above. It corresponds to the following idea:\n",
|
"To compute $\\partial\\mathcal{L}/\\partial W$ we can use the **chaining rule** for computing derivatives of a composite function, as you can see in the formulae above. It corresponds to the following idea:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"* Suppose under given input we have obtanes loss $\\Delta\\mathcal{L}$\n",
|
"* Suppose under given input we have obtained loss $\\Delta\\mathcal{L}$\n",
|
||||||
"* To minimize it, we would have to adjust softmax output $p$ by value $\\Delta p = (\\partial\\mathcal{L}/\\partial p)\\Delta\\mathcal{L}$ \n",
|
"* To minimize it, we would have to adjust softmax output $p$ by value $\\Delta p = (\\partial\\mathcal{L}/\\partial p)\\Delta\\mathcal{L}$ \n",
|
||||||
"* This corresponds to the changes to node $z$ by $\\Delta z = (\\partial\\mathcal{p}/\\partial z)\\Delta p$\n",
|
"* This corresponds to the changes to node $z$ by $\\Delta z = (\\partial\\mathcal{p}/\\partial z)\\Delta p$\n",
|
||||||
"* To minimize this error, we need to adjust parameters accordingly: $\\Delta W = (\\partial\\mathcal{z}/\\partial W)\\Delta z$ (and the same for $b$)\n",
|
"* To minimize this error, we need to adjust parameters accordingly: $\\Delta W = (\\partial\\mathcal{z}/\\partial W)\\Delta z$ (and the same for $b$)\n",
|
||||||
|
|
@ -821,7 +821,7 @@
|
||||||
"source": [
|
"source": [
|
||||||
"## Training the Model\n",
|
"## Training the Model\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Now we are ready to write the **training loop**, which will go through our dataset, and perform the optimization minibatch by minibatch.One complete pass through the dataset is often called **an epoch**:"
|
"Now we are ready to write the **training loop**, which will go through our dataset, and perform the optimization minibatch by minibatch. One complete pass through the dataset is often called **an epoch**:"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -1169,7 +1169,7 @@
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
" Adding several layers make sense, because unlike one-layer network, multi-layered model will be able to accuratley classify sets that are not linearly separable. I.e., a model with several layers will be **reacher**.\n",
|
" Adding several layers make sense, because unlike one-layer network, multi-layered model will be able to accurately classify sets that are not linearly separable. I.e., a model with several layers will be **reacher**.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"> It can be demonstrated that with sufficient number of neurons a two-layered model is capable to classifying any convex set of data points, and three-layered network can classify virtually any set.\n",
|
"> It can be demonstrated that with sufficient number of neurons a two-layered model is capable to classifying any convex set of data points, and three-layered network can classify virtually any set.\n",
|
||||||
"\n",
|
"\n",
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ Let's start with formalizing the Machine Learning problem. Suppose we have a tra
|
||||||
* For regression problem, when we need to predict a number, we can use **absolute error** ∑<sub>i</sub>|f(x<sup>(i)</sup>)-y<sup>(i)</sup>|, or **squared error** ∑<sub>i</sub>(f(x<sup>(i)</sup>)-y<sup>(i)</sup>)<sup>2</sup>
|
* For regression problem, when we need to predict a number, we can use **absolute error** ∑<sub>i</sub>|f(x<sup>(i)</sup>)-y<sup>(i)</sup>|, or **squared error** ∑<sub>i</sub>(f(x<sup>(i)</sup>)-y<sup>(i)</sup>)<sup>2</sup>
|
||||||
* For classification, we use **0-1 loss** (which is essentially the same as **accuracy** of the model), or **logistic loss**.
|
* For classification, we use **0-1 loss** (which is essentially the same as **accuracy** of the model), or **logistic loss**.
|
||||||
|
|
||||||
For one-level perceptron, function *f* was defined as a linear function *f(x)=wx+b* (here *w* is the weight matrix, *x* is the vector if input features, and *b* is bias vector). For different neural network architectures, this function can take more complex form.
|
For one-level perceptron, function *f* was defined as a linear function *f(x)=wx+b* (here *w* is the weight matrix, *x* is the vector of input features, and *b* is bias vector). For different neural network architectures, this function can take more complex form.
|
||||||
|
|
||||||
> In the case of classification, it is often desirable to get probabilities of corresponding classes as network output. To convert arbitrary numbers to probabilities (eg. to normalize the output), we often use **softmax** function σ, and the function *f* becomes *f(x)=σ(wx+b)*
|
> In the case of classification, it is often desirable to get probabilities of corresponding classes as network output. To convert arbitrary numbers to probabilities (eg. to normalize the output), we often use **softmax** function σ, and the function *f* becomes *f(x)=σ(wx+b)*
|
||||||
|
|
||||||
|
|
@ -68,7 +68,9 @@ In this lesson, we have built our own neural network library, and we have used i
|
||||||
|
|
||||||
## 🚀 Challenge
|
## 🚀 Challenge
|
||||||
|
|
||||||
In the accompanying notebook, you will implement your own framework for building and training multi-layered perceptrons. You will be able to see in detail how modern neural networks operate. Proceed to the [OwnFramework](OwnFramework.ipynb) notebook and work through it
|
In the accompanying notebook, you will implement your own framework for building and training multi-layered perceptrons. You will be able to see in detail how modern neural networks operate.
|
||||||
|
|
||||||
|
Proceed to the [OwnFramework](OwnFramework.ipynb) notebook and work through it.
|
||||||
|
|
||||||
## [Post-lecture quiz](https://black-ground-0cc93280f.1.azurestaticapps.net/quiz/8)
|
## [Post-lecture quiz](https://black-ground-0cc93280f.1.azurestaticapps.net/quiz/8)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ Lab Assignment from [AI for Beginners Curriculum](https://github.com/microsoft/a
|
||||||
|
|
||||||
Solve the MNIST handwritten digit classification problem using 1-, 2- and 3-layered perceptron. Use the neural network framework we have developed in the lesson.
|
Solve the MNIST handwritten digit classification problem using 1-, 2- and 3-layered perceptron. Use the neural network framework we have developed in the lesson.
|
||||||
|
|
||||||
|
|
||||||
## Stating Notebook
|
## Stating Notebook
|
||||||
|
|
||||||
Start the lab by opening [MyFW_MNIST.ipynb](MyFW_MNIST.ipynb)
|
Start the lab by opening [MyFW_MNIST.ipynb](MyFW_MNIST.ipynb)
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,12 @@ If you can see that overfitting occurs, you can do one of the following:
|
||||||
|
|
||||||
* Increase the amount of training data
|
* Increase the amount of training data
|
||||||
* Decrease the complexity of the model
|
* Decrease the complexity of the model
|
||||||
* Use some [regularization technique](../4-ComputerVision/08-TransferLearning/TrainingTricks.md), such as [Dropout](../4-ComputerVision/08-TransferLearning/TrainingTricks.md#Dropout), which we will consider later.
|
* Use some [regularization technique](../../4-ComputerVision/08-TransferLearning/TrainingTricks.md), such as [Dropout](../../4-ComputerVision/08-TransferLearning/TrainingTricks.md#Dropout), which we will consider later.
|
||||||
|
|
||||||
## Overfitting and Bias-Variance Tradeoff
|
## Overfitting and Bias-Variance Tradeoff
|
||||||
|
|
||||||
Overfitting is actually a case of more generic problem in statistics, called [Bias-Variance Tradeoff](https://en.wikipedia.org/wiki/Bias%E2%80%93variance_tradeoff). If we consider possible sources of error in our model, we can see two types of errors:
|
Overfitting is actually a case of more generic problem in statistics, called [Bias-Variance Tradeoff](https://en.wikipedia.org/wiki/Bias%E2%80%93variance_tradeoff). If we consider possible sources of error in our model, we can see two types of errors:
|
||||||
|
|
||||||
* **Bias errors** are caused by our algorithm not being able to capture the relationship between training data correctly. It can result from the fact that our model is not powerful enough (**underfitting**).
|
* **Bias errors** are caused by our algorithm not being able to capture the relationship between training data correctly. It can result from the fact that our model is not powerful enough (**underfitting**).
|
||||||
* **Variance errors**, which are caused by the model approximating noise in the input data instead of meaningful relationship (**overfitting**).
|
* **Variance errors**, which are caused by the model approximating noise in the input data instead of meaningful relationship (**overfitting**).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,4 +35,4 @@ Low-Level API | [TensorFlow+Keras Notebook](IntroKerasTF.ipynb) | [PyTorch](Intr
|
||||||
--------------|-------------------------------------|--------------------------------
|
--------------|-------------------------------------|--------------------------------
|
||||||
High-level API| [Keras](IntroKeras.ipynb) | *PyTorch Lightning*
|
High-level API| [Keras](IntroKeras.ipynb) | *PyTorch Lightning*
|
||||||
|
|
||||||
After mastering the frameworks, let's recap the notion of [overfitting](Overfiting.md).
|
After mastering the frameworks, let's recap the notion of [overfitting](Overfitting.md).
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
Loading…
Reference in New Issue