1
00:00:00,190 --> 00:00:01,160
All righty.

2
00:00:01,230 --> 00:00:03,520
Now we've covered mean absolute error.

3
00:00:03,540 --> 00:00:09,480
We're going to have a look at Main squared error here actually and make a little heading as usual because

4
00:00:09,480 --> 00:00:12,220
we're keeping our notebook nice and clean.

5
00:00:12,280 --> 00:00:14,300
I mean squared error.

6
00:00:14,400 --> 00:00:15,110
Wonderful.

7
00:00:15,870 --> 00:00:17,720
And then we're going to go means squared error.

8
00:00:17,740 --> 00:00:18,660
Now you might.

9
00:00:18,750 --> 00:00:25,920
Based off what we've looked at with mean absolute error you might be able to deduce how we might calculate

10
00:00:26,040 --> 00:00:35,920
means squared error if not again perfectly fine so if we come down here from that skyline dot matrix

11
00:00:36,610 --> 00:00:42,540
import mean squared error wonderful.

12
00:00:42,650 --> 00:00:45,100
And so we're going to do it basically in the exact same way.

13
00:00:45,110 --> 00:00:51,170
So MSE equals mean squared error except this time instead of using absolute we're going to be using

14
00:00:51,170 --> 00:00:56,150
squared then we're going to take the Y test labels and because we've already made predictions up here

15
00:00:56,350 --> 00:00:57,610
why spreads.

16
00:00:57,800 --> 00:01:01,200
We could make them again but we might just reuse values here.

17
00:01:01,280 --> 00:01:02,590
Why spreads.

18
00:01:02,990 --> 00:01:09,170
Actually for completeness what we might do is just the Y spreads equals model not predict and we're

19
00:01:09,170 --> 00:01:15,450
predicting on The X test data because we want to compare our predictions to the Y test data.

20
00:01:15,470 --> 00:01:19,550
They're going to have look at MSA nine point two for two.

21
00:01:19,870 --> 00:01:20,830
Mm hmm.

22
00:01:20,980 --> 00:01:25,670
It's a little bit higher than what we got with mean absolute error.

23
00:01:25,670 --> 00:01:31,210
Well that's because MSE or main square I should put MSA in here right.

24
00:01:31,220 --> 00:01:38,780
Because there's so many acronyms these days MSE will always be higher than mean absolute error because

25
00:01:38,960 --> 00:01:43,910
it squares the errors rather than only taking the absolute difference into account.

26
00:01:43,910 --> 00:01:48,470
So if we come up here and have a look this data frame would be the exact same here.

27
00:01:48,470 --> 00:01:55,910
So what mean absolute error does is it takes these values and it turns negatives into positive adds

28
00:01:55,900 --> 00:02:03,140
them all up and then finds the average over what means squared error does is it takes these values squares

29
00:02:03,140 --> 00:02:08,720
them then adds them all up and then finds the average hence the main squared error.

30
00:02:08,750 --> 00:02:14,780
So that's why the squaring part squaring these numbers will lead to a higher number here.

31
00:02:14,780 --> 00:02:16,610
Actually we might just do it.

32
00:02:16,610 --> 00:02:20,030
So let's see if we can calculate MSE by hand.

33
00:02:20,040 --> 00:02:22,830
And this is dangerous right we're going off the record here.

34
00:02:23,120 --> 00:02:25,400
Calculate MSA by hand.

35
00:02:25,580 --> 00:02:35,290
So all we have to do is take the differences here so actually def differences we need a square that

36
00:02:36,520 --> 00:02:37,940
actually might do here.

37
00:02:37,990 --> 00:02:38,970
So.

38
00:02:39,550 --> 00:02:46,930
Is it empty square empty askew square dance differences and then should we add a called the main on

39
00:02:46,930 --> 00:02:47,540
that actually.

40
00:02:47,710 --> 00:02:54,020
Let's put that in brackets can we do that don't mean right.

41
00:02:54,220 --> 00:03:01,620
Squared equals that what does squared look like OK.

42
00:03:01,650 --> 00:03:07,960
So this is going to take this column here and squared now to calculate the MSE.

43
00:03:08,010 --> 00:03:12,260
We just need to take the main of squared beautiful.

44
00:03:12,270 --> 00:03:13,610
There we go.

45
00:03:13,650 --> 00:03:16,500
See that's how we calculate the main squared error.

46
00:03:16,500 --> 00:03:17,250
That's it right.

47
00:03:17,250 --> 00:03:21,570
We've covered means quite ere we covered mean absolute error and we covered square.

48
00:03:21,570 --> 00:03:27,780
Now the next logical question is and even if you aren't asking it is which regression evaluation metric

49
00:03:27,840 --> 00:03:29,150
should you use.

50
00:03:29,160 --> 00:03:34,800
So we look here we'll come back to the KEYNOTE so our squared is similar to accuracy right.

51
00:03:34,810 --> 00:03:38,030
It gives you a quick indication of how well your model might be doing.

52
00:03:38,080 --> 00:03:43,660
Generally the closer you are squared value or coefficient of determination value is to 1 the better

53
00:03:43,660 --> 00:03:44,210
the model.

54
00:03:44,560 --> 00:03:49,570
But as we've seen before us square doesn't really tell us exactly how wrong our model is in terms of

55
00:03:49,840 --> 00:03:56,440
how far off each prediction is for that mean absolute error gives a better indication of how far off

56
00:03:56,470 --> 00:03:59,470
each of your model's predictions are on average.

57
00:03:59,470 --> 00:04:00,790
So that's when we saw this one here.

58
00:04:00,790 --> 00:04:01,200
Right.

59
00:04:01,210 --> 00:04:07,330
This is how we saw on average each of our models predictions is about two point one two away from what

60
00:04:07,330 --> 00:04:08,420
it actually should be.

61
00:04:08,470 --> 00:04:10,510
Whether that's positive or negative.

62
00:04:10,510 --> 00:04:17,290
And so we come back here now can get a bit confusing which to use between mean absolute error and mean

63
00:04:17,290 --> 00:04:18,340
squared error.

64
00:04:18,400 --> 00:04:21,540
Well because of the way main squared error is calculated.

65
00:04:21,640 --> 00:04:23,800
We saw that by calculating it by hand.

66
00:04:23,800 --> 00:04:28,540
We squared the differences and then took the main right instead of just taking the absolute differences

67
00:04:29,170 --> 00:04:35,110
because of how MSE is calculated squaring the differences between predicted values and actual values.

68
00:04:35,260 --> 00:04:37,450
It amplifies larger differences.

69
00:04:37,450 --> 00:04:42,150
So you could imagine if we had a difference of say 10 and we squared that right.

70
00:04:42,160 --> 00:04:45,600
That's going to be now a difference of 100 and we're taking the average of that.

71
00:04:45,670 --> 00:04:49,630
So let's say we're predicting the value of houses which we are.

72
00:04:49,780 --> 00:04:57,100
You want to pay more attention to mean absolute error when being ten thousand dollars off is only twice

73
00:04:57,100 --> 00:04:59,770
as bad as being 5000 dollars off.

74
00:04:59,890 --> 00:05:01,000
So that makes sense right.

75
00:05:02,430 --> 00:05:09,840
But pay attention more to means squared error when being ten thousand dollars off is more than twice

76
00:05:09,840 --> 00:05:12,230
as bad as being five thousand dollars off.

77
00:05:12,300 --> 00:05:18,160
You might think well it's not really if I double 5000 dollars to ten thousand dollars.

78
00:05:18,180 --> 00:05:25,040
So this is kind of another way of saying is that when bigger errors are bigger than smaller errors.

79
00:05:25,110 --> 00:05:25,370
Right.

80
00:05:25,370 --> 00:05:30,840
So if we're ten thousand dollars off and that's way worse than being 5000 dollars off we want to look

81
00:05:30,840 --> 00:05:32,640
more to means squared error.

82
00:05:32,670 --> 00:05:39,010
Long story short you want to a little tidbit here is for regression models you want to minimize mean

83
00:05:39,010 --> 00:05:46,830
squared error and minimize mean absolute era while maximizing r squared right.

84
00:05:46,880 --> 00:05:47,750
So does that make sense.

85
00:05:47,800 --> 00:05:57,250
Minimize mean absolute error minimize means squared error while maximizing R squared.

86
00:05:57,300 --> 00:06:02,580
Now that we've covered a handful of some of the most useful in common regression metrics we come back

87
00:06:02,580 --> 00:06:02,990
here.

88
00:06:03,030 --> 00:06:06,170
We see that there's still a fair few more that we could have done right.

89
00:06:06,180 --> 00:06:09,630
So that's a little challenge to you is to dive into model evaluation metrics.

90
00:06:09,630 --> 00:06:15,600
But the ones we've gone through a more than enough to get started you might be thinking hold on.

91
00:06:15,600 --> 00:06:21,390
We haven't even used the scoring parameter which is what we talked about five or six videos ago.

92
00:06:21,390 --> 00:06:26,100
Well now that we've covered some of the as I said some of the most common and useful regression and

93
00:06:26,100 --> 00:06:31,680
classification metrics we can finally take a look at the scoring parameter which is what we'll do in

94
00:06:31,680 --> 00:06:32,670
the next couple of videos.
