In the last lecture, we have created the structure for our monthly levelle, Perceptron Morlin.
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 what model we are using.
Lost function as sparse, categorical cross and copy.
We are using this because our VI data is available in the form of labels in the word data.
We have specific labels for ten different items and that's why we are using this as part of what we
call Cross and Groppi.
If instead we had probabilities for a class in the word Y variable, then we had to use Categorical
Cross and Groppi.
But since we have labels, we are using the sparse, categorical Cross and Groppi.
And suppose we had binary labels such as Yosano or Cool False.
In that case, we had to use Binary Cross and Groppi.
You can get details of all these lost functions in the official get us 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 my code can take.
You can look at all other optimizers and lost function and matrixes in the following documentation's.
Then for optimizer, we are using as Judy, as Judy simply stands for stochastic gradient descent.
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 script, edit and so on.
So basically, we have to provide this information before fitting our training data.
So just fundis this come on, you are giving three parameters.
Combining.
Snow, we have compiled over the next step, this to fit extreme and Vytorin data in this model.
This this index of fitting the model we are calling dark matter.
And then we are providing extreme Vytorin, the number of epochs.
I hope you remember what epoxide we have discussed in our tury lectures and by before the epochs value
is set to one.
So if you're born mentioned epoch by default, the value is one.
And then since we have validation data one.
So we are providing X valued and very valid datasets that we have created in our previous lectures.
We are storing this object with another object, which we are calling a mortally history.
So let's run this.
You can see at each epoch during the screaming, Kate has 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 retired zero point zero eight accuracy is zero point nine
seven for our validation set loss is zero point three nine and accuracy is zero point eight eight.
So the food just compared with the first epoch.
Well, to the accuracy on the 12 relevation set during our first epoch was zero point date me.
Now you can see what regulation, accuracy's oscillating matola training accuracy.
So during the first epoch, the accuracy score was four nine five two.
And after the last book, that curacy score is zero point nine seven.
So in each book, the training accuracy is increasingly developed.
Snow V of Crane, no data.
There are few more parameters that are available with fit method.
One important parameter is glass weights.
So if you have some uneven distribution of your classes and you are way variable.
So suppose all over 60000 reports, 50000 would be shirts and dress soft.
Nine categories are spread across the remaining 10000 records.
Then we have to use Clausewitz to give larger weight to underrepresented classes and to give lower weights
to 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 weights.
But if in your example, there is some or not representation of some specific classes, then you have
to use class weights after fitting into more than you can call different attributes of forward more
than history object.
So you can call barometer's.
This will give you information of all the parameters that we have use in training 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 right here object me.
And then right dot history.
This will give you all the laws, accuracy, relevation loss and validation, accuracy in the form of
dictionary.
So this is the lost 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 for today's box.
And lastly, the validation accuracy for today box.
So all the information which you were getting while training your data.
You can also access that information by using street attribute.
You can also blog this information to visualize how our accuracy is skorts are changing with each epoch.
So here I am just learning more than history and art history.
The information that we have here.
And then we won the grades in our Lord.
And then we want our Y-axis to be within Zied Wentland to plourde this.
You will get a graph of this kind on top.
We have an orange line of training accuracy.
Then we have a red 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 valuation, accuracy is increasing and
the loss is decreasing.
You can also tell that the model has not convert yet as the validation accuracy is still going up and
the validation loss is still going low.
So for our next try, we should gruninger for some more epochs.
And if you call the fit my turn again.
Kiraz will continue to train this model where you left off.
So that's what if you just run this call again.
The guitar will train this model for 30 more epochs and you will get Grauwe from here.
So try running it for 30 more epochs in the next will.
We will learn how to predict values using this model.
Thank you.