Welcome back.
It's the last video we covered are to score and so this one we're gonna look at mean absolute era.
Let's come down here.
We'll create a little heading mean absolute error.
Okay I am.
Ay ay.
Now again we could always look up what mean absolute error is but what we're going to do is check in
with the code first and then we'll look into it.
How do we calculate it.
I mean absolute error you might be able to deduce from its name what it actually does if not.
That's right.
We'll look into it.
Import mean absolute needed square.
That's gonna be the next one to evaluate it we need to make some predictions because remember a valuation
metrics are always comparing truth labels to predicted labels.
So we'll predict on the test data set and go and they E equals mean absolute error.
And we're going to compare y test which is the truth labels that we made up here.
Why test to our predictions.
Which is why we've just made here and then going to have a look at M.J. OK.
That wasn't too hard but two point one too.
What does that mean.
Well again this might be a little bit easier to visualize so we might create a data frame side by side
we're going to posit data equals a dictionary and we're gonna have actual values vs. what we want here
is predicted values go y parades wonderful and then we'll have a look at f huh.
So what do we have here.
Well this is the truth labels and this is what our model has predicted.
So can see twenty three point six is twenty three point 0 0 2.
Okay.
Thirty two point four thirty point nine point two.
Looking at these right and then looking at this number can you think about where this number might be
coming from.
That's right.
He can't what we might do is add another column that may add a little bit of clarity equals and we're
going to do.
Def predicted value.
So this is this is a column we're creating for the differences right.
So the difference between our predicted value and the actual values.
There we go.
We'll be IDF again.
Differences.
OK.
So we see that this one is minus point six or.
This one is minus point five and this one is three point ones was a bit off here and this one was really
off right.
It's minus four point eighty seven.
Okay.
So now you might be starting to get an idea of where mean absolute error comes from if not mean absolute
error it's formally defined as the average of the absolute differences between predictions and actual
values and so it gives you an idea of how wrong your predictions are.
So what we might do is write that here.
So amazing is the average of the absolute differences between predictions and actual values.
It gives you an idea of how wrong your models predictions are and what it means by absolute is that
it would turn these values positive and then add them all up and then take the main and then that's
going to give us this number.
So basically what this is saying is that on average every prediction our model makes is going to be
on average plus or minus two point one two away from the actual value.
And you can kind of see that right.
Some are only point six six seven away but others are more than two point one.
So this is 2.8 9 and this is negative 3 point 7 9 4 and you can keep going throughout all the 102 rows
and figure out this figure manually or you could just take the psychic learn implementations word for
it.
So what we're gonna do next that's covered mean absolute error.
We're going to have a look at Main squared error.