In the last lecture we have created the structure for our monthly parts of from more than now before
dreaming this model we need to set up the learning processes and to do that.
We will use the combined method we will first give the lost function.
Then we will give the optimizer and then the metrics we want to calculate to judge the performance of
our model.
We are using lost function as sparse categorical cross and copy.
We are using this because our y data is available in the form of labels in our data.
We have specific labels for ten different items and that's why we are using this as sparse categorical
cross and copy.
If instead we had probabilities for a class in our Y variable then we had to use categorical cross entropy.
But since we have labels we are using sparse categorical cross and copy and suppose we had binary labels
such as Yes or no or true or false.
In that case we had to use binary cross and copy you can get details of all these lost functions in
the official cross documentation.
I have provided the link of that documentation so if you open it you will get details of all the parameters
that this compiling method can take.
You can look at all other optimizations and lost function and metrics in the following documentations
then for optimize it we are using as duty as duties simply stands for sarcastic clearly and designed.
In other words we are just telling us to perform back propagation algorithm and for metrics we are using
accuracy since we are building a classifier.
We have to use accuracy if you are using the regression model.
You can use mean squared.
Edit and so on.
So basically we have to provide this information before fitting or training data.
So just on this Come on you are giving three parameters.
Combining
snow we have compiled our modern Lexus step this to fit extremely inviting data in this model.
This does an index of fitting the model we are calling dot fake matter.
And then we are providing extreme right train the number of epochs.
I hope you remember what epochs are.
We have discussed it in our two re lectures and by default the epochs value is set to 1.
So if you've blown mentioned epoch by default the value is 1 and then since we have validation data
as well so we are providing X valid and Y valid datasets that we have created in our previous lectures.
We are storing this object in another object which we are calling your model history.
So let's run this.
You can see at each epoch during the training chaos displayed a number of instances.
Process so far
you can see there is a progress bar and we are getting information of each epochs and then we are also
getting the loss accuracy validation loss and validation accuracy during each epoch
so it will take some time depending on your system configurations.
So I'm just fast forwarding this
now the training is complete.
You can see that the loss on our training is zero point zero.
Accuracy zero point nine seven for our validation site the loss is zero point three day and accuracy
is zero point eighty eight.
So if you just converted the first epoch value the accuracy on what the regulations say during our first
epoch was that upon date night
now you can see what validation accuracy is oscillating our training accuracy so during the first epoch
the accuracy score was point 9 5 2 and after the last book the accuracy score is zero point nine seven.
So in each epoch the training accuracy is increasingly developing.
So now we have trained no data there are few more parameters that are available with fit my code.
One important parameter is glass weights.
So if you have some uneven distribution of your classes in your Y variable so suppose all of over sixty
thousand records fifty thousand would be shirts and dress of nine categories are spread across the remaining
ten thousand records.
Then we have to use glass suites to give larger weight to underrepresented classes and to give lower
weights to or what we presented classes since in our dataset.
The categories are uniformly spread and there is no uneven distribution of categories.
That's why we are not using class fruits.
But if in your example there is some underrepresentation of some specific classes then you have to use
class weights after fitting your more than you can call different attributes of a modern history object
so you can call parameters.
This will give you information of all the parameters that we have used in creating this model.
We have another parameter that is dot epoch that will give you details of each epoch and the most important
attribute is history.
So a few write your object name and then write dot history.
This will give you all the laws accuracy regulation loss and validation accuracy in the form of dictionary.
So this is the last value on our training set for the Today box.
Then we have the accuracy value on our training set for the Today box.
Then we have the validation loss of today box.
And lastly the validation accuracy for today box so all the information which you were getting while
in training your data.
You can also access that information by using street attribute.
You can also block this information to visualize how our accuracy escorts are changing with each epoch.
So here I am just plotting model history not history.
The information that we have here and then we won the grades in our plot and then we want our y axis
to be which means we don't learn to plot this you will get a graph of the screen on top.
We have an orange line of training accuracy.
Then we have a direct line of validation accuracy.
Then we have a green line of validation loss and then a blue line of training loss.
If you can see with each epoch the training accuracy and the validation accuracy is increasing and the
loss is decreasing.
You can also tell that the model has not converged yet as the validation that accuracy is still going
up and the validation loss is still going low.
So for our next strike we should run it for some more epochs.
And if you call the fit my turn again.
Kira's will continue to train this model where you left off.
So that's why a few just this.
Again the Kira will create this model for today more epochs and you will get graph from here.
So try running it for 30 more epochs in the next will you we will learn how to predict values using
this model.
Thank you.