chapter 4 copyedits
This commit is contained in:
parent
7f6d918845
commit
3a3a2857a0
|
|
@ -1,14 +1,16 @@
|
|||
# Introduction to Neural Networks. Multi-Layered Perceptron
|
||||
|
||||
In the previous section, we have learnt about simplest neural network model - one-layered perceptron. It was a liner two-class classification model.
|
||||
In the previous section, you learned about the simplest neural network model - one-layered perceptron, a linear two-class classification model.
|
||||
|
||||
In this section we will extend this model into more flexible framework, allowing us to:
|
||||
In this section we will extend this model into a more flexible framework, allowing us to:
|
||||
|
||||
* perform **multi-class classification** in addition to two-class
|
||||
* solve **regression problems** in addition to classification
|
||||
* separate classes that are not linearly separable
|
||||
|
||||
We will also develop our own modular framework in Python that will allows us to construct different neural network architectures.
|
||||
We will also develop our own modular framework in Python that will allow us to construct different neural network architectures.
|
||||
|
||||
## [Pre-lecture quiz](https://black-ground-0cc93280f.1.azurestaticapps.net/quiz/7)
|
||||
|
||||
## Formalization of Machine Learning
|
||||
|
||||
|
|
@ -23,7 +25,7 @@ For one-level perceptron, function *f* was defined as a linear function *f(x)=wx
|
|||
|
||||
In the definition of *f* above, *w* and *b* are called **parameters** θ=⟨*w,b*⟩. Given the dataset ⟨**X**,**Y**⟩, we can compute an overall error on the whole dataset as a function of parameters θ.
|
||||
|
||||
**The goal of neural network training is to minimize the error by varying parameters θ**
|
||||
> ✅ **The goal of neural network training is to minimize the error by varying parameters θ**
|
||||
|
||||
## Gradient Descent Optimization
|
||||
|
||||
|
|
@ -38,31 +40,45 @@ During training, the optimization steps are supposed to be calculated considerin
|
|||
|
||||
## Multi-Layered Perceptrons and Back Propagation
|
||||
|
||||
One-layer network, as we have seen above, is capable of classifying linearly separable classes. To build reacher model, we can combine several layers of the network. Mathematically it would just mean that the function *f* would have more complex form, and will be computed in several steps:
|
||||
One-layer network, as we have seen above, is capable of classifying linearly separable classes. To build a richer model, we can combine several layers of the network. Mathematically it would mean that the function *f* would have a more complex form, and will be computed in several steps:
|
||||
* z<sub>1</sub>=w<sub>1</sub>x+b<sub>1</sub>
|
||||
* z<sub>2</sub>=w<sub>2</sub>α(z<sub>1</sub>)+b<sub>2</sub>
|
||||
* f = σ(z<sub>2</sub>)
|
||||
|
||||
Here, α is a **non-linear activation function**, σ is a softmax function, and parameters θ=<*w<sub>1</sub>,b<sub>1</sub>,w<sub>2</sub>,b<sub>2</sub>*>.
|
||||
|
||||
The gradient descent algorithm would remain the same, but it would be more difficult to calculate gradients. Given the
|
||||
chain differentiation rule, we can calculate derivatives as:
|
||||
The gradient descent algorithm would remain the same, but it would be more difficult to calculate gradients. Given the chain differentiation rule, we can calculate derivatives as:
|
||||
|
||||
* ∂ℒ/∂w<sub>2</sub> = (∂ℒ/∂σ)(∂σ/∂z<sub>2</sub>)(∂z<sub>2</sub>/∂w<sub>2</sub>)
|
||||
* ∂ℒ/∂w<sub>1</sub> = (∂ℒ/∂σ)(∂σ/∂z<sub>2</sub>)(∂z<sub>2</sub>/∂α)(∂α/∂z<sub>1</sub>)(∂z<sub>1</sub>/∂w<sub>1</sub>)
|
||||
|
||||
Note that the left-most part of all those expressions is the same, and thus we can effectively calculate derivatives starting from the loss function and going "backwards" through the computational graph. Thus the method of training multi-layered perceptron is called **back propagation**.
|
||||
> ✅ The chain differentiation rule is used to calculate derivatives of the loss function with respect to parameters.
|
||||
|
||||
Note that the left-most part of all those expressions is the same, and thus we can effectively calculate derivatives starting from the loss function and going "backwards" through the computational graph. Thus the method of training a multi-layered perceptron is called **backpropagation**, or 'backprop'.
|
||||
|
||||
<img src="images/ComputeGraphGrad.PNG" width="400px" align="right"/>
|
||||
|
||||
We will cover back prop in much more detail in our notebook example.
|
||||
## [Proceed to Notebook](OwnFramework.ipynb)
|
||||
> TODO: image citation
|
||||
|
||||
In the accompanying notebook, we will implement our own framework for building and training multi-layered perceptrons. You will be able to see in detail how modern neural networks operate. Proceed to [OwnFramework](OwnFramework.ipynb) notebook.
|
||||
> ✅ We will cover backprop in much more detail in our notebook example.
|
||||
|
||||
## [Lab](lab/README.md)
|
||||
## Conclusion
|
||||
|
||||
In this lesson, we have our own neural network library, and we have used for a simple two-dimensional classification task. In this lab, you are asked to use this framework to solve MNIST handwritten digit classification.
|
||||
In this lesson, we have built our own neural network library, and we have used it for a simple two-dimensional classification task.
|
||||
|
||||
## 🚀 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
|
||||
|
||||
## [Post-lecture quiz](https://black-ground-0cc93280f.1.azurestaticapps.net/quiz/8)
|
||||
|
||||
## Review & Self Study
|
||||
|
||||
Backpropagation is a common algorithm used in AI and ML, worth studying [in more detail](https://wikipedia.org/wiki/Backpropagation)
|
||||
|
||||
## [Assignment](lab/README.md)
|
||||
|
||||
In this lab, you are asked to use the framework you constructed in this lesson to solve MNIST handwritten digit classification.
|
||||
|
||||
* [Instructions](lab/README.md)
|
||||
* [Notebook](lab/MyFW_MNIST.ipynb)
|
||||
Loading…
Reference in New Issue