sklearn.linear_model.LinearRegression.score
score(self, X, y, sample_weight=None)
Returns the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1 - u/v), where u is the residual sum of squares ((y_true - y_pred) ** 2).sum() and v is the total sum of squares ((y_true - y_true.mean()) ** 2).sum(). The 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.
作用:返回该次预测的系数R2

本文介绍了sklearn库中LinearRegression模型的score函数,该函数计算预测的R^2得分,即(1 - u/v),其中u是残差平方和,v是总平方和。R^2最佳分数为1.0,可以为负,0.0表示模型预测仅等于y的期望值。
最低0.47元/天 解锁文章
1988

被折叠的 条评论
为什么被折叠?



