11
$\begingroup$

I was reading about regression metrics in the python scikit-learn manual and even though each one of them has its own formula, I cannot tell intuitively what is the difference between $R^2$ and variance score and therefore when to use one or another to evaluate my models.

$\endgroup$
3
$\begingroup$
  1. $R^2 = 1- \frac{SSE}{TSS}$
  2. $\text{explained variance score} = 1 - \mathrm{Var}[\hat{y} - y]\, /\, \mathrm{Var}[y]$, where the $\mathrm{Var}$ is biased variance, i.e. $\mathrm{Var}[\hat{y} - y] = sum(error^2 - mean(error))\,/\,n$. Compared with $R^2$, the only difference is from the mean(error). if mean(error)=0, then $R^2$ = explained variance score

  3. Also note that in adjusted-$R^2$, unbiased variance estimation is used.

$\endgroup$
  • 2
    $\begingroup$ sklearn doesn't have adjusted-R2 does it? $\endgroup$ – Hack-R Jun 8 '17 at 15:05
  • $\begingroup$ @Hack-R actually it have $\endgroup$ – mMontu Dec 24 '18 at 17:33
1
$\begingroup$

Dean's answer is right.

Only I think there is a minor typo here: $Var[\hat{y}-y]=sum(error^2-mean(error))/n$.

I guess it should be $Var[\hat{y}-y]=sum(error-mean(error))^2/n$.

My reference is the source code of sklearn here:https://github.com/scikit-learn/scikit-learn/blob/bf24c7e3d/sklearn/metrics/_regression.py#L396

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.