A wrapper for gbm::gbm() for use in nadir::super_learner().
Arguments
- data
A dataframe to train a learner / learners on.
- formula
A regression formula to use inside this learner.
- weights
Observation weights passed to
gbm::gbm(). Defaults toNULL, in which case equal weights (rep(1, nrow(data))) are used.- verbose
(default: FALSE) if set to TRUE, information about the automatic outcome type inferred by
gbmwill be messaged to the console, as well as the number of trees used.- n.minobsinnode
(default: 0) An integer specifying the minimum number of observations in the terminal nodes of the trees. See the gbm documentation for more. Set here to 0 to account for the potential of very small splits in cross-fitting.
- ...
Any extra arguments that should be passed to the internal model for model fitting purposes.
Value
A prediction function that accepts newdata,
which returns predictions (a numeric vector of values, one for each row
of newdata).
Examples
lnr_gbm(mtcars, mpg ~ hp)(mtcars)
#> [1] 21.65804 21.65804 23.04591 21.65804 17.64625 21.33453 13.81187 27.00216
#> [9] 22.80081 19.34433 19.34433 16.07177 16.07177 16.07177 12.90349 12.90349
#> [17] 13.81187 29.98783 27.85215 32.91892 22.12126 17.34718 17.34718 13.81187
#> [25] 17.64625 29.98783 24.87716 22.60625 14.02533 17.64625 14.02533 21.65804
