学习笔记2:scikit-learn中使用r2_score评价回归模型

在sklearn中包含四种评价尺度,分别为mean_squared_error、mean_absolute_error、explained_variance_score 和 r2_score。

1、均方差(mean-squared-error)


2、平均绝对值误差(mean_absolute_error)


3.可释方差得分(explained_variance_score) 

explained variation measures the proportion to which a mathematical model accounts for the variation (dispersion) of a given data set


4.中值绝对误差(Median absolute error)


5.R2 决定系数(拟合优度)


模型越好:r2→1

模型越差:r2→0

用法示例

from sklearn.metrics import r2_score

y_true = [1,2,4]
y_pred = [1.3,2.5,3.7]
r2_score(y_true,y_pred)



猜你喜欢

转载自blog.csdn.net/Softdiamonds/article/details/80061191
今日推荐