Home Artificial Intelligence The Bias-Variance Tradeoff

The Bias-Variance Tradeoff

2
The Bias-Variance Tradeoff

The bias-variance tradeoff is a very important concept in machine learning, which represents the strain that a model has between its ability to cut back the errors on the training set (its ) versus its ability to generalize well to recent unseen examples (its ).

Usually, as we make our model more complex (e.g., by adding more nodes to a call tree), its bias decreases because the model adapts itself to the particular patterns and peculiarities of the training set (learning the training examples “by-heart”), and consequently the model loses its ability to generalize and supply good predictions on the test set (i.e., its variance increases).

Formal Evaluation

  1. in the info itself. This noise could also be caused attributable to various reasons, equivalent to internal noise within the physical devices that generated our measurements, or errors made by humans that entered the info into our databases.
  2. The of the model, which represents the difference between the model’s predictions and the true labels of the info.
  3. The of the model, which represents how the model’s predictions vary across different training sets.

In the next sections we’re going to prove the next statement:

Typically, we cannot control the interior noise, but only the bias and the variance components of the prediction error. And because the prediction error of a given model is constant, trying to cut back its bias will increase its variance and vice versa (thereby we now have the ).

Assume that we now have a training set of n sample points, denoted by D = {(x₁, y₁), (x₂, y₂), … , (xₙ, yₙ)}, where xᵢ represents the features of point i (typically xᵢ is a vector) and yᵢ represents the true label of that time.

We assume that the labels are generated by some unknown function
y = f(x) + ϵ, which our model is attempting to learn.
ϵ represents the intrinsic noise of the info, and we assume that it’s uniformly distributed across all the info points with expected value of 0 (E[ϵ] = 0), and an ordinary deviation of σ (Var[ϵ] = σ²).

The function that our model learns from the given training set is known as the model’s and denoted by h(x).

Our goal is to seek out an hypothesis h(x) that’s as close as possible to the true function f(x), or in other words, we would love to reduce the mean squared error between h(x) and the true labels y across all of the possible data sets D that would have been used to coach the model:

The subscript D is used to point that the model was built based on a selected training set D.

A model with a great generalization ability should give similar predictions no matter the particular training set that was used to coach it, since that may mean that the model has learned the overall patterns in the info, moderately than adapting itself to the particular peculiarities of the training set that was used to coach it.

Formal Proof

By rearranging the terms and expanding the square brackets we get:

From the linearity of expectation we get:

The last term is the same as zero, because the expectation of the product of two variables is the product of the person expectations, and the expectation of the noise is 0 ((E[ϵ] = 0). Due to this fact, we will write:

Because the noise ϵ doesn’t depend upon the particular training set D, and its variance is the same as σ², we will write:

We now make use of the incontrovertible fact that Var(X) = E[X²] – E[X]² to jot down:

And by rearranging the terms we get:

Since f(x) doesn’t depend upon the particular training set D, it doesn’t affect the variance, thus we will write:

Substituting this expression back into the equation for the prediction error we get our outcome:

The primary term on the correct side of this equation represents the bias squared, since E[f(x)-h(x)] is the expected error between the model’s predictions and the true function. The second term represents the variance of the model, and the third term represents the noise.

Due to this fact, we now have shown that:

Image taken from https://mlu-explain.github.io/bias-variance/

Finding the Right Balance

When the model is simply too easy (e.g., using a linear regression to model a posh function), it ignores useful information in the info set, and due to this fact it is going to have a high bias. On this case, we are saying that the model is the info.

When the model is simply too complex (e.g., using a polynomial with a high degree to model an easy function), it adapts itself to the particular training set and due to this fact has a high variance. On this case, we are saying that the model is the info.

Due to this fact, we must always strive to seek out a model that lays within the sweet spot between overfitting and underfitting, i.e., a model that shouldn’t be too easy nor too complex.

There are numerous ways to seek out such models, depending on the particular machine learning algorithm that you simply are using. For instance, we will use regularization to manage the tradeoff between the bias and variance.

Regularization

Cost(h) = Training Error(h) + λ Complexity(h)

λ is a hyperparameter that controls the tradeoff between the bias and the variance. Higher λ will induce a bigger penalty on the complexity of the model, and thus will result in simpler models with higher error on the training set but with smaller variance.

The complexity of the model could be measured in other ways. For instance, in linear regression the complexity is usually specified by the dimensions of the model’s parameters (weights).

You’ll find more details about regularization in this text of mine.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here