All right, no.
As I have told you before, we need to use a laser that is called flatten, this flatten is going to
take this Max pulling its and remember, the layer that makes pulling is actually an image that is 2D.
And we remember also that the fully connected layer is actually one dimensional.
It's like a bunch of nodes all stacked vertically.
Right.
So we need to convert this 2D array to one D array and we need to convert it.
Right.
The way to do that is by simply calling the flatten class.
So it's like a layer here.
Actually we're going to add classifier then add and all we need to do is just type flat.
That's now the final layer is actually my fully connected layer, which is added by typing dense, so
we need to classifier.
The.
And what do I want to add here?
I'm going to be adding that's the way to do that is by simply typing dense.
Now, let's input its parameters now my dance is going to have 64, let's say, notes, and it's going
to have an activation of Reller.
Sorry, not Prentice's.
Here, we need to add it's like this.
OK.
Now, we have finalized our layers, however, there is one more thing the last layer cannot be Relu
is not the right layer.
In order to predict a class, we need another activation function that is called softmax.
Now, softmax is a function is going to tell you a percentage probability of the class you are predicting.
OK, so let's say you input number five.
The softmax is actually going to calculate the probability for all the classes together and it's going
to give you a probability for each of them.
So the softmax is the function to do that.
And it should when you give it number five as an image, it should take the class, which is number
five, and give it the highest probability.
Right.
Like, OK, I'm guessing that this is number five.
And then they give it the probability of zero point nine, meaning around 90 percent.
The other classes should be like one percent, two percent, 50 percent, meaning zero point five.
So, yeah, the way to do that is by adding a softmax.
The way to add softmax is by saying classifier, don't add.
Now this is how we're going to do it.
We're going to type two for sort of flow, gives the players the dance.
And then what do we need to pass to this?
Well, what you need to pass here is actually the number of classes you have.
In our case, we have numbers between zero and nine.
This gives us 10 classes, right?
Including the zero.
So we have ten classes and the activation is going to be self.
Max.
Right now, we have stacked all of our layers together.
Let me recap, sequential is to stack all their lives together.
I have convolutional layer here, number of filters and the size of the kernel.
I have another mix pulling.
Then I repeat, I love the convolutional layer, another mix pulling.
Then I convert the max, pulling all the 2D array to one the array, and then I take a real activation
function on the fully connected layer.
And finally I apply softmax in order to give a probability for every class.
OK, now in the next lecture we're going to continue with new stuff and we're going to add to our code
before we can run it and let it learn our images.