2

After tuning a learner and using it, we can use it to make predictions through the command line

predict(Learner, newdata, predict_type="response")

But, how do we compute confidence intervals for predictions?


task <- TaskRegr$new("data", data, "y")
learner <- lrn("regr.xgboost")
preprocess <- po("scale", param_vals = list(center = TRUE, scale = TRUE))
pp <- preprocess %>>% learner
gg<- GraphLearner$new(pp)
gg$train(task)
predict(gg, newdata = pred, predict_type="reponse")
Nip
  • 387
  • 4
  • 11
  • `predict_type = "se"` – Lars Kotthoff Oct 07 '20 at 18:48
  • It throws an error --- `Error: Predict type 'se' not available`. I'm using `regr.xgboost` in a `GraphLearner`. – Nip Oct 07 '20 at 18:52
  • 1
    Can you post a complete example that allows to reproduce this please? You probably just have to adjust how the model is trained. – Lars Kotthoff Oct 07 '20 at 19:52
  • When I use `lrn("regr.featureless", predict_type = "se")` it shows not errors at all. `lrn("regr.xgboost", predict_type = "se")` throws `Error: Learner 'regr.xgboost' does not support predict type 'se'`, however. Is it just me? – Nip Oct 07 '20 at 20:09
  • 5
    No, not all learners support prediction errors, xgboost being one of them. You'll have to use a different learner to get error estimates. – Lars Kotthoff Oct 07 '20 at 20:50
  • @LarsKotthoff Could you post this as a full answer? Thanks. – pat-s Nov 06 '20 at 21:51
  • Done @pat-s. This comment is not at least 15 characters in length. – Lars Kotthoff Nov 06 '20 at 22:17

1 Answers1

6

Not all learners support prediction errors, xgboost being one of them. You'll have to use a different learner to get error estimates.

Lars Kotthoff
  • 107,425
  • 16
  • 204
  • 204