Explore Courses Blog Tutorials Interview Questions
0 votes
in Machine Learning by (19k points)
The R^2 value returned by scikit learn (metrics.r2_score()) can be negative. The docs say:

"Unlike most other scores, R² score may be negative (it need not actually be the square of a quantity R)."

However the wikipedia article on R^2 mentions no R (not squared) quantity. Perhaps it uses absolute differences instead of square differences. I really have no idea

1 Answer

0 votes
by (33.1k points)
The R^2 value in scikit learn is the same on the coefficient of determination. It is a 1-residual sum of square / total sum of squares.

The big difference between a classical stats setting and machine learning is that you evaluate your score on unseen data, which can lead to results outside [0,1]. If you apply R^2 to the same data you used to fit your model, it will lie within [0, 1]

Hope this answer helps you!

Browse Categories