迴歸評估
你在前一個練習建立的 test_set 和 model 物件已載入到你的環境中。
用一個數字呈現預測的準確度很實用。你就能輕鬆比較多個模型,並向現在或未來的雇主展示進步。
Root Mean Squared Error(均方根誤差,RMSE)和 Mean Absolute Error(平均絕對誤差,MAE)是評估迴歸模型時最常用的指標。回顧其公式:
\(RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n}(y_i - \hat{y}_i)^2}\)
\(MAE = \frac{1}{n} \sum_{i=1}^{n} |y_i - \hat{y}_i|\)
本練習屬於課程
用 R 練習統計面試題
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Assign Hwt from the test set to y
___ <- test_set$___
# Predict Hwt on the test set
___ <- ___(model, newdata = ___)
# Derive the test set's size
___ <- nrow(___)