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

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

  • 相关阅读:
    整合规则引擎urule
    vue学习
    发送put请求,get请求
    jpa自定义字段
    spring的3种配置方式
    netty
    springsercurity和shiro
    git报错
    Scrapy全站数据爬取
    python操作Excel模块openpyxl
  • 原文地址:https://www.cnblogs.com/rayshaw/p/8628174.html
Copyright © 2011-2022 走看看