Feynman Liang created SPARK-9005:
------------------------------------

             Summary: RegressionMetrics computing incorrect explainedVariance 
and r2
                 Key: SPARK-9005
                 URL: https://issues.apache.org/jira/browse/SPARK-9005
             Project: Spark
          Issue Type: Bug
          Components: MLlib
            Reporter: Feynman Liang


{{RegressionMetrics}} currently computes explainedVariance using 
{{summary.variance(1)}} (variance of the residuals) where the [Wikipedia 
definition|https://en.wikipedia.org/wiki/Fraction_of_variance_unexplained] uses 
the residual sum of squares {{math.pow(summary.normL2(1), 2)}}. We should 
change to be consistent.

The computation for r2 is also currently incorrect. Multiplying by 
{{summary.count - 1}} appears to be trying to compute an adjusted r2, but the 
lack of a DoF adjustment in the numerator makes the computation inconsistent 
with [Wikipedia's 
definition|https://en.wikipedia.org/wiki/Coefficient_of_determination]. Since 
{{RegresionMetrics}} is not given the number of regression variables, we should 
modify and explicitly document that this computes unadjusted R2.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to