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]]
Michael Dewey
2019-Dec-22 16:07 UTC
[R] How to find the absolute residuals in train function
Dear Javed Comment in-line On 22/12/2019 14:10, javed khan wrote:> 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)Did you mean bo_search or bo_mod?> > 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]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Michael http://www.dewey.myzen.co.uk/home.html