Bias-variance tradeoff
The bias–variance tradeoff describes a common tension in machine learning: a model can miss real patterns, or it can fit the training examples so closely that its predictions change too much when those examples change.
Also known as: смещение и разброс
Two ways predictions can go wrong
Imagine training the same kind of model on many fresh datasets drawn from the same population. Each fitted model then predicts the outcome for the same input. Bias is the difference between the average of those predictions and the true average outcome at that input. Variance measures how much the predictions differ across training runs. A model can be consistently wrong (high bias), or its predictions can swing widely even if their average is close to the truth (high variance).
Why there is a tradeoff
For squared-error regression, at a fixed input, expected squared prediction error = squared bias + prediction variance + irreducible noise. The last term captures how much outcomes can differ even when the input features are identical. No model can predict that part from those features alone. This exact decomposition is for squared error; it does not carry over unchanged to metrics like classification accuracy.
More flexible models can capture patterns that simpler models miss, reducing bias. But with limited data, that flexibility often makes the fitted model more sensitive to which examples it sees. The goal is not to make bias and variance equal. It is to minimize error on new data, and sometimes you can reduce variance without making the model simpler, for example by collecting more representative training data.
Example: tuning a decision tree
Suppose a tree predicts delivery times from distance and time of day. A tree with only one split may miss the fact that rush hour matters more for longer trips. A very deep tree may create a leaf for a handful of orders that happened to be delayed, turning a fluke into a prediction rule. Compare candidate depths using validation data that reflect how the model will be used. If it will predict future deliveries, validate on later orders rather than randomly mixing past and future. Keep a separate test set for the final evaluation after tuning.
What interviewers look for
You may be given training and validation errors and asked what to try next. Low training error and much higher validation error suggest overfitting if the split is appropriate, but the gap is not a direct measurement of variance. For a deep tree, try limiting its depth or requiring more examples per leaf, then check whether validation error improves. If both errors are high, compare against a baseline and check whether the features contain enough signal before assuming that a more complex model will help.