回归预测评估指标

回归预测评估指标

标注说明

f 表示预测值,y 表示实际值

评价指标

  • MAE(Mean Absolute Error) 平均绝对误差
    MAE=1ni=1n|fiyi|
  • MSE(Mean Square Error) 平均平方差/均方误差是回归任务最常用的性能度量。
    MSE=1ni=1n(fiyi)2
  • RMSE(Root Mean Square Error) 方均根差

    RMSE=MSE

    缺点:因为它使用的是平均误差,而平均误差对异常点较敏感,如果回归器对某个点的回归值很不合理,那么它的误差则比较大,从而会对RMSE的值有较大影响,即平均值是非鲁棒的。
  • MAPE
    全称是Mean Absolute Percentage Error(WikiPedia), 也叫mean absolute percentage deviation (MAPD),在统计领域是一个预测准确性的衡量指标。

    MAPE=100nt=1n|yifiyi|
  • R平方
    y¯ 表示观测数据的平均值
    残差平方和

    SSres=(yifi)2

    总平均值
    SStot=(yiy¯)2

    R平方
    r2=1SSresSStot=1(yifi)2(yiy¯)2

    R平方是多元回归中的回归平方和占总平方和的比例,它是度量多元回归方程中拟合程度的一个统计量,反映了在因变量y 的变差中被估计的回归方程所解释的比例。
    R平方越接近1,表明回归平方和占总平方和的比例越大,回归线与各观测点越接近,用x 的变化来解释y 值变差的部分就越多,回归的拟合程度就越好。
  • 校正R平方
    http://www.statisticshowto.com/adjusted-r2/
    这里写图片描述

    where: N is the number of points in your data sample.
    K is the number of independent regressors, i.e. the number of variables in your model, excluding the constant

  • RMSPE

    RMSPE=1ni=1n(yiŷ iyi)2

    where yi denotes the sales of a single store on a single day and ŷ i denotes the corresponding prediction.

https://www.kaggle.com/cast42/xgboost-in-python-with-rmspe-v2/code

def rmsle(predicted,real):
    sum=0.0
    for x in range(len(predicted)):
        p = np.log(predicted[x]+1)
        r = np.log(real[x]+1)
        sum = sum + (p - r)**2
    return (sum/len(predicted))**0.5
# https://www.kaggle.com/jpopham91/rmlse-vectorized
# vectorized error calc
def rmsle(y, y0):
    assert len(y) == len(y0)
    return np.sqrt(np.mean(np.power(np.log1p(y)-np.log1p(y0), 2)))
发布了69 篇原创文章 · 获赞 45 · 访问量 19万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章