[ https://issues.apache.org/jira/browse/SPARK-9005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14624077#comment-14624077 ]
Apache Spark commented on SPARK-9005: ------------------------------------- User 'feynmanliang' has created a pull request for this issue: https://github.com/apache/spark/pull/7361 > 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