In this session, we want to see what's the effect of choosing different numbers of neurons in our head
and linger.
Now, let's take a look at this one.
I'm going to use X1 and why two X1 has 50 samples and why one is equal to sign us up x1.
This is over target to Ivon.
We're looking for a sign of X.
I already plotted them.
Now let's just call a tool or simply click on neural net fitting tools.
Here is of our neural network and as you can see, the activation function of each layer is here for
this one forever hidden layer.
We are using the sigmoid activation function and we use this one whenever we want to have a pattern
recognition.
We just want to classify them into different sets and for our altered layer, it just used linear function.
So click on next and let's use of our data again.
Why one four of our targets and of our inputs are X1.
Each of them has 50 samples.
Let's just click the next.
And I'm not going to change the validation and testing percentage for now.
Let's just remain midwifing.
Here it is.
I want to see the effect of different number of hidden neurons in our system.
As I already explained, we can change the number of neurons in our hidden layer, but we cannot change
the number of neurons in our output layer.
The reason is we have only one output so we can not have more than one neuron here.
If we had two outputs, then we could have two neurons and number of neurons for other outputs and there
is equal to number of our outputs.
But in this part, let's change it to one.
Let's start with one and then see what would be the effect on our network.
Click on next and then click on train.
OK, the validation checks stopped our training, let Assad be checking the performance, OK is of our
performance and this is the validation.
We just start to failing and finally stopped our training.
I'm going to check the feting.
Let's take a look at this one.
Can you guess what is this?
By looking at this one, we can see this is a sigmoid and this is just like reverse of a sigmoid.
And the reason that we can see it here, because one of the weights was negative.
So it just got reversed and it just fitted to our data.
Here are the data.
Here are the samples.
We were expecting something like that, like a sign of Suape lot.
The best feting that the network was able to give us is this one.
Maybe you ask your question why it just didn't took it up to here.
If you start doing this sigmoid from here, then it can not satisfied samples.
But by choosing and a middle this path, it can just satisfy all the samples in the same range to me.
Just retrain the nets for this time.
You're going to choose to narrowings for our hidden layer and see what will happen next.
OK, here it's the training result.
Again, the validation check has stopped our training.
Let's see the fitting.
OK, here it is.
I remember we have only two narratives.
As you can see, we have already two.
This is one sigmoid still here and this is another sigmoid.
Our network tried its best to fit into the data by using two sigmoid activation function and we can
already see these two.
This is one and this is another one.
This one has a negative rate.
That's why it's reversed.
But this one is just look like a sigmoid and tonja and hyperbolic.
OK, let's just increase the number of neurons to three and see how can our network behave with three
neurones in a hidden layer.
So let's go to the fitting tools and see the result.
OK, the result now it's better with even tweaking around, we were able to have a sign in shape and
identify the three neurons.
Maybe this is one of them.
This is one sigmoid.
This is, I can say the second sigmoid.
And from here to here, this is our third sigmoid.
By changing the weights and testing it again, our network was able to feed the best that it can with
using Htwe Sigmoid and three narrowings.
Now let's increase the numbers to ten and see what would happen if we have pin neurons in our hidden
layer.
Just click on train and see the result.
Go straight to the fitting.
Got OK.
Here we have this line.
This way.
We have some errors here and it's not a very good feed here.
Something happened which we really don't want it.
Sometimes giving more Naranj to other network can mislead the behavior of our network.
It's not always good to choose a very high number of neurons, but it's very important to calculate
the correct number of neurons in each layer and then choose it based on your data.
So let's check what will happen if I have, let's say, 20 neurons.
Twenty neurons in our network.
Click on train.
Let's see what happened.
Oh, OK.
Here it is.
We just ask our network to learn the pattern.
Using twenty sigmoid.
I'm using twenty neurons here.
That's why it's not where we curve.
It's not look like a sinus wave and it's not a curved line.
It has too many facilities and it has too many activation function.
It just calls this shape and we can say the network has been overtrained.
Sometimes when we give too many Klip man too many facilities to an A student, the result can be negative
and the student might be overtrain because he has too many facilities.
It has too many men that it can cause over training.
So it's not a very good thing to choose to many neurons.
But the question is, how can we know what's the best number of neurons?
Four of our head and layer.
We already saw that in this example.
One, Neron is not enough to Neroni is not good, treatment is good, ten is a bit too much and 20 neurons
actually not very good.
And this is not acceptable.
This not look like a sign of sweet.
It's very important to know the best number of neurons for training and network based on our samples
and data.
In the next session I will explain how can we calculate the best number of neurons when we want to train
our neural network?