00:03Now, you see here, in this case, your mean absolute error is greater than your mean square
00:12error.
00:14Now, take the case when the errors are large.
00:17So, suppose we take the values of errors, the errors are say 1, 5 and 3 for 3 data points.
00:28So, if you do the MSc calculation, what will come, one third, 1 square plus 5 square plus
00:373 square, that is equal to 1 by 3, 1 plus 25 plus 9, that is 1 by 3 of
00:5035 equal to 11.67,
00:56fine.
00:57Now, we will do the same calculation for, with the same errors, we will do the calculation
01:04for mean absolute error.
01:06So, for mean absolute error, what will come, 1 by 3, 1 plus 5 plus 3, that is equal to
01:15one
01:16third of 5 plus 1, 6 plus 3, 9.
01:18So, it is equal to 3.
01:22In this case, if we see our MSc value is greater than mean absolute error.
01:33Now, what does it mean?
01:35Now, what does it mean?
01:36It means, when the error is high, which is possible or which is probable, when you have outliers
01:43in your data set, then your MSc will be much higher than MAE.
01:48So, MSc or the mean squared error is known to be very sensitive to outliers because it squares
02:00those errors.
02:01yi minus yi hat will be much higher in case of data points which are outliers.
02:07And in mean squared error, what we are doing is we are squaring those.
02:10So, it is making it magnified whereas, in mean absolute error, we are just taking the absolute
02:18difference.
02:19That is the reason it does not penalize so much, it is not so sensitive to outliers whereas,
02:26mean squared error is very sensitive to outliers, ok.
02:31Then we go to loss function for classification problem.
02:36Now, in classification, we have various kinds of classification.
02:40Binary classification like in email is spam or not spam.
02:44And in this case, the type of loss function that we use is binary cross entropy loss.
02:50And the number of output neurons in the output layer of a binary classifier is equal to 1.
02:57Then we have something called as the multi class classification.
03:00Suppose your training data have images of cat, dog and horses.
03:05And you have given only a horse image for classification.
03:11Then that is called as the multi class classification problem.
03:14And the loss function that we have for multi class classification is categorical cross entropy loss.
03:21And the number of output nodes in the output layer for a multi class classification model
03:26is equal to the number of classes that are present in the data.
03:31Then we have something called as the multi label classification.
03:34What is this multi level classification?
03:37Just have a look here.
03:38In this picture, we have three things.
03:43There is a cat, there is a flower and there is a bird.
03:49So, there are three different labels that are present in this picture, ok.
03:53So, this is called as and suppose there is some horse also is there nearby.
03:59So, when we have something called as the multi label classification.
04:13In multi label classification, just have a look here.
04:16There is a cat's image and there is a bird's image.
04:19So, there are two labels that are present here.
04:21So, there are more than one label that is present in the image.
04:26So, this is called as multi label classification.
04:29So, if you have horse, cat, dog and bird, cat and bird are the two labels that are present in
04:35this image, ok.
04:38And for this kind of multi label classification, what we do is we do binary cross entropy loss for each
04:45of the labels.
04:45That means, we will for the cat, we will have a binary cross entropy loss to calculate whether it is
04:51there is a cat or not a cat.
04:53Or same thing will happen for the bird also, whether there is a bird or not a bird.
05:00And then finally, this binary cross entropy losses from each of these classes and then summed together to find out
05:08the final loss.
05:10And then number of output nodes is equal to the number of labels in the image.
05:17Now, we will just have a detailed view of binary cross entropy loss which we also call as log loss.
05:26So, in binary classification, we know that we use sigmoid activation function.
05:31This sigmoid activation function basically squishes any real value between 0 and 1.
05:36We have seen it in just a few slides before.
05:41And if the output node value is greater than 0.5, we call it as positive class or the true
05:46class.
05:47If the output node value is less than 0.5, we call it as a negative class or 0 class,
05:52ok.
05:53Class 1 and 0 class.
05:54And the loss term for a single instance is equal to y into minus log of y predicted plus 1
06:03minus y into minus log of 1 minus y pred.
06:07It means if your positive class is or the true class is a puppy and the negative class is a
06:15kitten, then this is coming for the positive class and this is coming for the negative class.
06:21This is for a single instance and when we want to have the total average binary cross entropy loss,
06:29we divide it by the number of observations.
06:32Now, here we see the loss is y into minus log y predicted plus 1 minus y minus log of
06:391 minus
06:39y predicted.
06:40Y predicted is the prediction from the model whereas, y is the actual ground truth.
06:46In this case, it is the dog.
06:50So, if we see here, we have a graph, this first graph which plots log x in the interval of
06:590 to 1.
07:00So, you see the log x values look like this.
07:03When we do a minus log x plot, it looks like this.
07:07And if you see in the first term as well as in the second term, we have minus log of
07:12something.
07:13So, our plots will look like this.
07:15And then, this is the binary cross entropy loss.
07:22The blue curve is for the true value or the true class 1 and the orange one is for the
07:33negative
Comments