Bootstrap Ensemble Learner with SE Prediction
Source:R/LearnerRegrBootstrapSE.R
mlr_learners_regr.bootstrap_se.RdWraps any regression learner and trains a bootstrap ensemble. Predictions return mean and SE across bootstrap samples.
Creates a new instance of this R6 class.
Arguments
- learner
(mlr3::LearnerRegr)
Base learner to bootstrap.
Details
This learner creates a bootstrap ensemble by:
Taking
n_bootstrapbootstrap samples (sampling with replacement)Training the base learner on each sample and storing the trained state
During prediction, restoring each state and computing predictions
Computing mean and SD of predictions across the ensemble
The standard deviation across bootstrap predictions serves as the standard error estimate.
The wrapped base learner ($wrapped) remains untrained after training the wrapper.
Use $base_learner() to get a trained clone of the base learner.
Fields
wrapped(
LearnerRegr)
Read-only access to the wrapped base learner.param_set(paradox::ParamSet)
The combined parameter set.
Fields
$wrapped:: mlr3::LearnerRegr
Read-only access to the wrapped base learner.
Examples
if (FALSE) { # \dontrun{
# Wrap ranger with bootstrap SE
learner <- lrn("regr.bootstrap_se", learner = lrn("regr.ranger"))
learner$param_set$set_values(n_bootstrap = 10)
# Train on a task
task <- tsk("mtcars")
learner$train(task)
# Predict with SE
pred <- learner$predict(task)
pred$se # Standard errors
} # }