[R] How to find the absolute residuals in train function

javed khan j@vedbtk111 @end|ng |rom gm@||@com
Sun Dec 22 15:10:24 CET 2019


Hello

I am using caret's train function and it gives me the results (MAE or RMSE
in this case). How can I find the absolute residuals i.e. the difference
between the predicted and actual values of test data. I am using the
following code, but it does not work (give error message).

bo_mod <- train(log10(Price) ~ ., data = tr,
                method = "svmRadial",

                metric = "MAE",
                trControl = ctrl,

                preProc = c("center", "scale", "zv"),
                tuneGrid = data.frame(sigma = 10^(bo_search$Best_Par[1]),
                C = 10^(1)))
postResample(predict(bo_mod, ts), log10(ts$Price))/// till here I get the
output, but when I use the following

res=log10(tr$Price) - predict(bo_search, tr)

I get the error:  Error in UseMethod("predict") :
  no applicable method for 'predict' applied to an object of class
"c('double', 'numeric')"

	[[alternative HTML version deleted]]



More information about the R-help mailing list