﻿1
00:00:00,600 --> 00:00:09,120
‫In the last lecture we have created the structure for our monthly parts of from more than now before

2
00:00:09,120 --> 00:00:16,860
‫dreaming this model we need to set up the learning processes and to do that.

3
00:00:17,010 --> 00:00:23,150
‫We will use the combined method we will first give the lost function.

4
00:00:23,280 --> 00:00:30,850
‫Then we will give the optimizer and then the metrics we want to calculate to judge the performance of

5
00:00:30,890 --> 00:00:32,640
‫our model.

6
00:00:33,780 --> 00:00:39,190
‫We are using lost function as sparse categorical cross and copy.

7
00:00:39,870 --> 00:00:47,750
‫We are using this because our y data is available in the form of labels in our data.

8
00:00:47,760 --> 00:00:56,010
‫We have specific labels for ten different items and that's why we are using this as sparse categorical

9
00:00:56,010 --> 00:00:58,590
‫cross and copy.

10
00:00:58,590 --> 00:01:08,280
‫If instead we had probabilities for a class in our Y variable then we had to use categorical cross entropy.

11
00:01:08,670 --> 00:01:19,410
‫But since we have labels we are using sparse categorical cross and copy and suppose we had binary labels

12
00:01:20,160 --> 00:01:23,130
‫such as Yes or no or true or false.

13
00:01:23,130 --> 00:01:33,130
‫In that case we had to use binary cross and copy you can get details of all these lost functions in

14
00:01:33,140 --> 00:01:36,250
‫the official cross documentation.

15
00:01:36,500 --> 00:01:45,620
‫I have provided the link of that documentation so if you open it you will get details of all the parameters

16
00:01:45,710 --> 00:01:49,000
‫that this compiling method can take.

17
00:01:49,340 --> 00:01:56,840
‫You can look at all other optimizations and lost function and metrics in the following documentations

18
00:02:00,240 --> 00:02:10,290
‫then for optimize it we are using as duty as duties simply stands for sarcastic clearly and designed.

19
00:02:10,970 --> 00:02:20,360
‫In other words we are just telling us to perform back propagation algorithm and for metrics we are using

20
00:02:20,450 --> 00:02:25,310
‫accuracy since we are building a classifier.

21
00:02:25,310 --> 00:02:29,440
‫We have to use accuracy if you are using the regression model.

22
00:02:29,690 --> 00:02:31,810
‫You can use mean squared.

23
00:02:31,820 --> 00:02:33,820
‫Edit and so on.

24
00:02:35,720 --> 00:02:41,120
‫So basically we have to provide this information before fitting or training data.

25
00:02:42,320 --> 00:02:46,920
‫So just on this Come on you are giving three parameters.

26
00:02:46,950 --> 00:02:47,600
‫Combining

27
00:02:52,010 --> 00:03:02,690
‫snow we have compiled our modern Lexus step this to fit extremely inviting data in this model.

28
00:03:02,750 --> 00:03:09,080
‫This does an index of fitting the model we are calling dot fake matter.

29
00:03:09,350 --> 00:03:15,100
‫And then we are providing extreme right train the number of epochs.

30
00:03:15,380 --> 00:03:17,310
‫I hope you remember what epochs are.

31
00:03:17,390 --> 00:03:25,480
‫We have discussed it in our two re lectures and by default the epochs value is set to 1.

32
00:03:25,550 --> 00:03:34,840
‫So if you've blown mentioned epoch by default the value is 1 and then since we have validation data

33
00:03:34,880 --> 00:03:44,180
‫as well so we are providing X valid and Y valid datasets that we have created in our previous lectures.

34
00:03:44,510 --> 00:03:50,970
‫We are storing this object in another object which we are calling your model history.

35
00:03:51,200 --> 00:04:02,420
‫So let's run this.

36
00:04:02,560 --> 00:04:09,820
‫You can see at each epoch during the training chaos displayed a number of instances.

37
00:04:09,820 --> 00:04:11,370
‫Process so far

38
00:04:15,740 --> 00:04:25,340
‫you can see there is a progress bar and we are getting information of each epochs and then we are also

39
00:04:25,340 --> 00:04:33,770
‫getting the loss accuracy validation loss and validation accuracy during each epoch

40
00:04:38,870 --> 00:04:44,540
‫so it will take some time depending on your system configurations.

41
00:04:44,540 --> 00:04:46,670
‫So I'm just fast forwarding this

42
00:04:59,140 --> 00:05:01,050
‫now the training is complete.

43
00:05:01,300 --> 00:05:06,460
‫You can see that the loss on our training is zero point zero.

44
00:05:06,940 --> 00:05:16,240
‫Accuracy zero point nine seven for our validation site the loss is zero point three day and accuracy

45
00:05:16,390 --> 00:05:19,490
‫is zero point eighty eight.

46
00:05:19,570 --> 00:05:27,550
‫So if you just converted the first epoch value the accuracy on what the regulations say during our first

47
00:05:27,580 --> 00:05:29,590
‫epoch was that upon date night

48
00:05:33,800 --> 00:05:44,290
‫now you can see what validation accuracy is oscillating our training accuracy so during the first epoch

49
00:05:45,000 --> 00:05:55,950
‫the accuracy score was point 9 5 2 and after the last book the accuracy score is zero point nine seven.

50
00:05:55,960 --> 00:06:01,720
‫So in each epoch the training accuracy is increasingly developing.

51
00:06:04,390 --> 00:06:14,860
‫So now we have trained no data there are few more parameters that are available with fit my code.

52
00:06:15,100 --> 00:06:19,170
‫One important parameter is glass weights.

53
00:06:19,450 --> 00:06:27,690
‫So if you have some uneven distribution of your classes in your Y variable so suppose all of over sixty

54
00:06:27,690 --> 00:06:36,580
‫thousand records fifty thousand would be shirts and dress of nine categories are spread across the remaining

55
00:06:36,580 --> 00:06:38,390
‫ten thousand records.

56
00:06:38,590 --> 00:06:49,270
‫Then we have to use glass suites to give larger weight to underrepresented classes and to give lower

57
00:06:49,270 --> 00:06:54,570
‫weights to or what we presented classes since in our dataset.

58
00:06:54,580 --> 00:07:01,860
‫The categories are uniformly spread and there is no uneven distribution of categories.

59
00:07:01,870 --> 00:07:05,600
‫That's why we are not using class fruits.

60
00:07:06,130 --> 00:07:13,990
‫But if in your example there is some underrepresentation of some specific classes then you have to use

61
00:07:14,000 --> 00:07:24,040
‫class weights after fitting your more than you can call different attributes of a modern history object

62
00:07:24,980 --> 00:07:28,530
‫so you can call parameters.

63
00:07:28,550 --> 00:07:33,870
‫This will give you information of all the parameters that we have used in creating this model.

64
00:07:36,800 --> 00:07:45,560
‫We have another parameter that is dot epoch that will give you details of each epoch and the most important

65
00:07:45,620 --> 00:07:47,840
‫attribute is history.

66
00:07:47,840 --> 00:07:54,880
‫So a few write your object name and then write dot history.

67
00:07:54,980 --> 00:08:04,370
‫This will give you all the laws accuracy regulation loss and validation accuracy in the form of dictionary.

68
00:08:04,370 --> 00:08:10,150
‫So this is the last value on our training set for the Today box.

69
00:08:10,250 --> 00:08:17,450
‫Then we have the accuracy value on our training set for the Today box.

70
00:08:17,450 --> 00:08:21,250
‫Then we have the validation loss of today box.

71
00:08:21,320 --> 00:08:32,410
‫And lastly the validation accuracy for today box so all the information which you were getting while

72
00:08:32,420 --> 00:08:33,490
‫in training your data.

73
00:08:33,590 --> 00:08:39,680
‫You can also access that information by using street attribute.

74
00:08:39,690 --> 00:08:49,970
‫You can also block this information to visualize how our accuracy escorts are changing with each epoch.

75
00:08:51,050 --> 00:08:55,870
‫So here I am just plotting model history not history.

76
00:08:55,880 --> 00:09:05,030
‫The information that we have here and then we won the grades in our plot and then we want our y axis

77
00:09:05,030 --> 00:09:14,990
‫to be which means we don't learn to plot this you will get a graph of the screen on top.

78
00:09:14,990 --> 00:09:18,360
‫We have an orange line of training accuracy.

79
00:09:18,440 --> 00:09:22,190
‫Then we have a direct line of validation accuracy.

80
00:09:22,190 --> 00:09:30,910
‫Then we have a green line of validation loss and then a blue line of training loss.

81
00:09:31,140 --> 00:09:39,920
‫If you can see with each epoch the training accuracy and the validation accuracy is increasing and the

82
00:09:39,920 --> 00:09:42,450
‫loss is decreasing.

83
00:09:42,560 --> 00:09:50,480
‫You can also tell that the model has not converged yet as the validation that accuracy is still going

84
00:09:50,480 --> 00:09:53,660
‫up and the validation loss is still going low.

85
00:09:55,640 --> 00:10:02,300
‫So for our next strike we should run it for some more epochs.

86
00:10:02,700 --> 00:10:05,800
‫And if you call the fit my turn again.

87
00:10:06,460 --> 00:10:10,600
‫Kira's will continue to train this model where you left off.

88
00:10:11,130 --> 00:10:14,600
‫So that's why a few just this.

89
00:10:14,700 --> 00:10:21,750
‫Again the Kira will create this model for today more epochs and you will get graph from here.

90
00:10:23,250 --> 00:10:32,550
‫So try running it for 30 more epochs in the next will you we will learn how to predict values using

91
00:10:32,550 --> 00:10:33,120
‫this model.

92
00:10:33,720 --> 00:10:34,130
‫Thank you.

