rasbt / machine-learning-book

Code Repository for Machine Learning with PyTorch and Scikit-Learn
https://sebastianraschka.com/books/#machine-learning-with-pytorch-and-scikit-learn
MIT License
3.66k stars 1.32k forks source link

P.292 Proof of R^2 is rescaled version of the MSE should be #69

Closed hongsoog closed 2 years ago

hongsoog commented 2 years ago

Now, let’s briefly show that $R^2$ is indeed just a rescaled version of the MSE:

$$ \begin{align} R^2 &= 1 - \frac{SSE}{SST} \ & = 1 - \frac{\frac{1}{n}SSE}{\frac{1}{n}SST} \ &= 1 - \frac{ \frac{1}{n} \sum{i=1}^{n} \big ( y^{(i)} - \hat{y}^{(i)} \big )^{2} } { \frac{1}{n} \sum{i=1}^{n} \big ( y^{(i)} - \mu_{y} \big )^{2} } \ &= 1 - \frac{MSE}{Var(y)} \end{align} $$

rasbt commented 2 years ago

Thanks, that extra step makes it more clear. I added it to the errata so that we don't forget to include it in case we make a reprint some time.