迴歸預測評估指標

迴歸預測評估指標

標註說明

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萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章