You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Imran Younus (JIRA)" <ji...@apache.org> on 2015/12/15 04:09:46 UTC

[jira] [Updated] (SPARK-12331) R^2 for regression through the origin

     [ https://issues.apache.org/jira/browse/SPARK-12331?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Imran Younus updated SPARK-12331:
---------------------------------
    Description: 
The value of R^2 (coefficient of determination) obtained from LinearRegressionModel is not consistent with R and statsmodels when the fitIntercept is false i.e., regression through the origin. In this case, both R and statsmodels use the definition of R^2 given by eq(4') in the following review paper:

https://online.stat.psu.edu/~ajw13/stat501/SpecialTopics/Reg_thru_origin.pdf

Here is the definition from this paper:
R^2 = \sum(\hat( y)_i^2)/\sum(y_i^2)

The paper also describes why this should be the case. I've double checked that the value of R^2 from statsmodels and R are consistent with this definition. On the other hand, scikit-learn doesn't use the above definition. I would recommend using the above definition in Spark.


  was:
The value of R^2 (coefficient of determination) obtained from LinearRegressionModel is not consistent with R and statsmodels when the fitIntercept is false i.e., regression through the origin. In this case, both R and statsmodels use the definition of R^2 given by eq(4') in the following review paper:

https://online.stat.psu.edu/~ajw13/stat501/SpecialTopics/Reg_thru_origin.pdf

Here is the definition from this paper:
R^2 = \sum(\hat(y)_i^2)/\sum(y_i^2)

The paper also describes why this should be the case. I've double checked that the value of R^2 from statsmodels and R are consistent with this definition. On the other hand, scikit-learn doesn't use the above definition. I would recommend using the above definition in Spark.



> R^2 for regression through the origin
> -------------------------------------
>
>                 Key: SPARK-12331
>                 URL: https://issues.apache.org/jira/browse/SPARK-12331
>             Project: Spark
>          Issue Type: Improvement
>          Components: ML
>            Reporter: Imran Younus
>            Priority: Minor
>
> The value of R^2 (coefficient of determination) obtained from LinearRegressionModel is not consistent with R and statsmodels when the fitIntercept is false i.e., regression through the origin. In this case, both R and statsmodels use the definition of R^2 given by eq(4') in the following review paper:
> https://online.stat.psu.edu/~ajw13/stat501/SpecialTopics/Reg_thru_origin.pdf
> Here is the definition from this paper:
> R^2 = \sum(\hat( y)_i^2)/\sum(y_i^2)
> The paper also describes why this should be the case. I've double checked that the value of R^2 from statsmodels and R are consistent with this definition. On the other hand, scikit-learn doesn't use the above definition. I would recommend using the above definition in Spark.



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

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