1
爲什麼結果1與結果2不同?直覺上我會認爲truc $ results $ RMSE是預測的均方根誤差,但我想不是。R包caret中的結果對象中的RMSE是什麼?
library(caret)
x <- data.frame(x = rnorm(15))
y <- x$x + rnorm(15)
myTimeControl <- trainControl(method = "timeslice",initialWindow = 10, horizon = 1, fixedWindow = FALSE, savePredictions=TRUE)
truc <- train(x,y,method = "lm",metric= "RMSE",trControl =myTimeControl,preProc = c("center", "scale"))
result1 <- sqrt(mean((truc$pred$pred-truc$pred$obs)^2))
result2 <- truc$results$RMSE
result1
result2
嗯,它是不是MSE,而是MAE。也許我應該告訴作者。非常感謝,我以爲我瘋了! –