Variance and Bias
Variance and Bias
Variance and Bias
Variance,L2 Reqularization
Bias and Variance
• By looking at the algorithm’s error on the training set(which we call bias) and on the
dev set(which we call variance) we can try different things to improve the algorithm
• What is bias?
• Bias is the difference between the average prediction of our model and the correct
value which we are trying to predict. Model with high bias pays very little attention to
the training data and oversimplifies the model. It always leads to high error on
training and test data.
• What is variance?
• Variance is the variability of model prediction for a given data point or a value which
tells us spread of our data. Model with high variance pays a lot of attention to training
data and does not generalize on the data which it hasn’t seen before. As a result, such
models perform very well on training data but has high error rates on test data.
How to address high Bias ?
• If our model is too simple and has very few parameters then it may
have high bias and low variance. On the other hand if our model has
large number of parameters then it’s going to have high variance and
low bias. So we need to find the right/good balance without
overfitting and underfitting the data.
• This tradeoff in complexity is why there is a tradeoff between bias and
variance. An algorithm can’t be more complex and less complex at the
same time.
Total Error
To build a good model, we need to find a good balance between bias and variance
such that it minimizes the total error.
• Mathematically
• Let the variable we are trying to predict as Y and other covariates as
X. We assume there is a relationship between the two such that
Y=f(X) + e
• Where e is the error term and it’s normally distributed with a mean of
0.
• We will make a model f^(X) of f(X) using linear regression or any other
modeling technique.
• So the expected squared error at a point x is
• The Err(x) can be further decomposed as