Imran Younus created SPARK-12331:
------------------------------------
Summary: 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: [email protected]
For additional commands, e-mail: [email protected]