zoukankan      html  css  js  c++  java
  • 机器学习1-关于回归问题的准确性评价

    网址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))

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

  • 相关阅读:
    c# 无边框窗体显示任务栏菜单(系统菜单)
    C# 任务栏的相关信息
    C# 获取屏幕尺寸
    C# winform 中的Form 源码
    C# datagridview 的属性及事件
    C# datagridview 中添加下拉框,并绑定selectedindexchanged事件
    C# 键盘事件
    Struts2的国际化
    Struts2类型转换器
    Struts2的运行流程以及关键拦截器介绍
  • 原文地址:https://www.cnblogs.com/rayshaw/p/8628174.html
Copyright © 2011-2022 走看看