In the book ESL (Element of Statistical Learning), the author introduces the EPE (Expected prediction Error) and the MSE (Mean Squared Error). I know that the EPE is defined as:


which is the expected value generated on all the different training data set.

But what abount the MSE? The author defined the MSE like:

$$MSE(x_0) = E_T[f(x_0)-\widehat{y_0})]^2$$

and i really don't get the difference... The question is: basically speaking, what's the difference between EPE and MSE?

  • 1
    $\begingroup$ IMO (In My Opinion) there are TMA (Too Many Abbreviations) IYP (In Your Post). TMA may cause confusion. In particular, IDK (I Don't Know) why ESE stands for Element of Statistical Learning. IMO it should be ESL. BTW (By The Way) the full names of EPE and MSE are not given IYP. $\endgroup$
    – WhatsUp
    Oct 21, 2021 at 11:04
  • $\begingroup$ Ok sorry, i edited with correction! $\endgroup$ Oct 21, 2021 at 11:07

1 Answer 1


The first one is calculating the error of the predictor function (over all possible values of $(X,Y)$) with a commonly used Loss function $L(Y,f(X))=(Y-f(X))^2$. So,

$$EPE(f(X))=E(L(Y,f(X))=E[(Y-f(X))^2]$$ This loss function is chosen arbitrarily and we could choose a different loss function if it suited our needs. For example we could choose the following loss function: $L(Y,f(X))=|Y-f(X)|$, then $$EPE(f(X))=E(L(Y,f(X))=E[|Y-f(X)|]$$

So, in some way, the term "expected prediction error" depends on the loss function.

The second one is calculating the expected error of $\hat{y_0}$, which is calculated in the following way:

  1. Calculate $(f(x_0)-\hat{y_0})^2$, which is the squared error of the prediction $\hat{y_0}$. Since in the book it's written that $Y=f(X)$, $f(x_0)$ is a constant. $\hat{y_0}$ is not a constant. The prediction, $\hat{y_0}$ depends on the given training set.
  2. Do (1) for all of the training sets (hence the expectation is with a subscript "$\mathcal{T}$" - you take the average over all training sets)
  3. Once you computed all of the errors across the training sets, sum them up
  4. Divide by the number of training sets.

So now you have the expected mean squared error (averaged over all training sets) of the point $x_0$.

The term "Mean Squared Error" is always the average of the sum of squared errors, independent of anything (as per definition of MSE).

  • $\begingroup$ First of all, thank you for the answer! But the predictor function is calculated over all the training set? Because maybe i have difficulty in understanding notations. Which is the difference between $Y, f(X), f(x_0), \widehat{y_0}$ ? $\endgroup$ Oct 22, 2021 at 9:29
  • $\begingroup$ @FedericoMondaini $Y$ and $f(X)$ are $n$ dimensional vectors, where $n$ is the dimensionality of the data. $f(x_0)=y_0\in\mathbb{R}$ is the value of $Y$ at point $x_0\in\mathbb{R}^n$. $\hat{y}_0$ is the prediction that we get when predicting what value $x_0$ will take. The EPE is calculated over all possible values of $X$ and $Y$ $\endgroup$
    – user
    Oct 22, 2021 at 12:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .