How to find the absolute residuals in train function

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to find the absolute residuals in train function

khan123
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: How to find the absolute residuals in train function

Michael Dewey-3
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]]
>
> ______________________________________________
> [hidden email] 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

______________________________________________
[hidden email] 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.