The R^2
in scikit learn is essentially the same as what is described in the wikipedia article on the coefficient of determination (grep for "the most general definition"). It is 1 - residual sum of square / total sum of squares
.
The big difference between a classical stats setting and what you usually try to do with machine learning, is that in machine learning 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]
See also this very similar question
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…