Hello and welcome back.
Today we've got a very exciting tutorial.
The bias variance trade off.
All right.
So to operate with these terms is first define them.
Bias is a systematic error that occurs in the machine learning model itself
due to incorrect assumptions in the machine learning process.
technically it can be thought of as the error between
the average model prediction and the ground truth, whereas variance is
how much the model can adjust depending on the given data set.
variance refers to changes in the model when using different portions
of the training data set.
Now let's visualize this to better understand it.
But first we're going to
refer to something we discussed previously which is k fold cross-validation.
So in k fold cross-validation we've got these metrics.
So we've done our we split a set.
We've got training set.
Then the training set we split into ten folds.
And so then we train the model on these nine folds combined.
And we validated two tests on this one left fold a left over fold.
Then we train the model on these nine folds.
And then we train test it on this one fold and so on.
And so and the result is a result.
We're slightly changing the training data just a little bit every time.
And we are validating or testing the resulting model
on a new unseen like on data that wasn't unseen was unseen during training.
And so we're getting these, sets of metrics.
And in case of ten fold cross-validation, we have ten metrics.
Now, if we plot this on the bias
variance curve on, like metaphorically speaking,
in the top left corner we'll have high bias, low variance.
So this is what happens, when you have high bias, low low variance.
Your, this is what you want to predict.
This is the target, but your model is all of those
predictions of all those, models that we just looked at.
They are far away from the target, but they're clustered together, right? So.
And what does that mean?
Well, that means that the model is too simple
and does not capture the underlying trend of the data.
So it's far away from the target.
but at the same time, their cluster,
on the other hand, you might have this situation
where you have low bias and high variance, where, your
the average of all of these models is on the target,
but at the same time, as you can see, every time we change the underlying
trend data slightly, the model result is different or varies.
And that's low bias, high variance.
And it means that the model is too sensitive
and is capturing noise as if it were a real trend.
It's overfitting to our data.
And both of these, scenarios, as you can imagine, are bad.
So in this case, we are away from the target.
In this case where, overfitting to the data.
And of course, if you, you can also have a scenario like this
where you have high bias and high variance.
So the average of these predictions is somewhere here, which is also away
from where we want it to be.
And they're also scattered across.
And this is the probably the worst of the three.
And here the model is too simple to capture the data trend
and it's too sensitive.
It captures noise as well.
So those are the three kind of non-ideal scenarios.
And here's the ideal scenario, which is kind of like the unicorn
where your, data is clustered together.
So you have low variance and it's in the right spot around.
So the average is the average that, we want to actually
we're aiming to predict.
So that therefore has got low bias.
And this is a great model.
It actually capture.
It accurately captures
the underlying trends of the data and generalizes well to unseen data.
Now the thing is that this is very rare.
And it's kind of like, a unicorn to catch this kind of scenario.
Most of the times you'll be trading off between this and this.
So if you make your model very sophisticated, then
you will indeed get a very good average score.
You'll be very close to what you're predicting,
but your you'll be capturing noise and data is.
And as soon as the data changes slightly, your model predictions will be off.
So it's not a good model in that sense.
Or if you make it
less complex, if your model is super sophisticated, it'll be here.
If it's less sophisticated, it'll end up here,
where it's too simple to even capture this.
Like, all the predictions will be close to each other,
but it's too simple to capture the, target.
And so you will have to be trading off between these two, making either simpler
or more complex, and finding your middle ground somewhere between them
and trying to be or aiming to be as close as possible to this scenario.
So that's how the bias variance tradeoff works, and that's how
we can combine it with k fold cross-validation to assess,
and understand our models better.
On that note, I look forward to seeing you back here next time.
And until then, enjoy machine learning.