决定系数R2
sklearn.metrics中r2_score
格式
sklearn.metrics.
r2_score
(y_true, y_pred, sample_weight=None, multioutput=’uniform_average’)
R^2 (coefficient of determination) regression score function.
R2可以是负值(因为模型可以任意差)。如果一个常数模型总是预测y的期望值,而忽略输入特性,则r^2的分数将为0.0。
Best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.
Parameters: |
---|