File tree 2 files changed +15
-5
lines changed
2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,13 @@ class RegressorMixin(object):
273
273
"""Mixin class for all regression estimators in scikit-learn"""
274
274
275
275
def score (self , X , y ):
276
- """Returns the coefficient of determination of the prediction
276
+ """Returns the coefficient of determination R^2 of the prediction.
277
+
278
+ The coefficient R^2 is defined as (1 - u/v), where u is the
279
+ regression sum of squares ((y - y_pred) ** 2).sum() and v is the
280
+ residual sum of squares ((y_true - y_true.mean()) ** 2).sum().
281
+ Best possible score is 1.0, lower values are worse.
282
+
277
283
278
284
Parameters
279
285
----------
8000
Original file line number Diff line number Diff line change @@ -624,16 +624,20 @@ def r2_score(y_true, y_pred):
624
624
625
625
Best possible score is 1.0, lower values are worse.
626
626
627
- Note: not a symmetric function.
628
-
629
- return the R^2 score
630
-
631
627
Parameters
632
628
----------
633
629
y_true : array-like
634
630
635
631
y_pred : array-like
636
632
633
+ Returns
634
+ -------
635
+ z : float
636
+ The R^2 score
637
+
638
+ Notes
639
+ -----
640
+ This is not a symmetric function.
637
641
"""
638
642
y_true , y_pred = check_arrays (y_true , y_pred )
639
643
numerator = ((y_true - y_pred ) ** 2 ).sum ()
You can’t perform that action at this time.
0 commit comments