首页 > 其他 > 详细

机器学习1-关于回归问题的准确性评价

时间:2018-03-30 01:03:17      阅读:299      评论:0      收藏:0      [点我收藏+]

网址https://book.douban.com/reading/46607817/

建立回归器后,需要建立评价回归器拟合效果的指标模型。

平均误差(mean absolute error):这是给定数据集的所有数据点的绝对误差平均值

均方误差(mean squared error):给定数据集的所有数据点的误差的平方的平均值,最流行

中位数绝对误差(mean absolute error):给定数据集的所有数据点的误差的中位数,可以消除异常值的干扰

解释方差分(explained variance score):用于衡量我们的模型对数据集波动的解释能力,如果得分为1.0,表明我们的模型是完美的。

R方得分(R2 score):读作R方,指确定性相关系数,用于衡量模型对未知样本预测的效果,最好的得分为1.0,值也可以是负数。

对应代码:

import sklearn.metrics as sm

print(mean absolute error=,round(sm.mean_absolute_error(y_test,y_test_pre),2))
print(mean squared error=,round(sm.mean_squared_error(y_test,y_test_pre),2))
print(median absolute error=,round(sm.median_absolute _error(y_test,y_test_pre),2))
print(explained variance score=,round(sm.explained_variance _score(y_test,y_test_pre),2))
print(R2 score=,round(sm.r2_score(y_test,y_test_pre),2))

通常情况下,尽量保证均方误差最低,而且解释方差分最高。

机器学习1-关于回归问题的准确性评价

原文:https://www.cnblogs.com/rayshaw/p/8628174.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!