Setup ConditionalSuperLearner Hyperparameters
Source:R/115_MetaLearners.R
setup_ConditionalSuperLearner.RdSetup hyperparameters for the Conditional SuperLearner, which selects the best model from a library conditional on the covariates rather than combining them.
Usage
setup_ConditionalSuperLearner(
base_learners = list(setup_GLM(), setup_GLMNET(), setup_Ranger()),
meta_learner = setup_Ranger(),
inner_resampling_config = setup_Resampler(n_resamples = 10L, type = "KFold"),
n_iterations = 4L,
loss = NULL,
init = "full",
min_region_size = 10L,
expand_search_spaces = TRUE,
ifw = FALSE
)Arguments
- base_learners
List of
Hyperparametersobjects: The experts. Names label the regions and the reported region sizes; unnamed entries are named after their algorithm.- meta_learner
Hyperparametersobject: The oracle, a classifier fitted on the extended dataset.- inner_resampling_config
ResamplerConfigobject: Cross-validation scheme, which must hold out every case exactly once.- n_iterations
(Tunable) Integer [1, Inf): Alternations between fitting the oracle and refitting the experts.
- loss
Optional Character {"squared_error", "log_loss"}: Per-case loss the oracle minimizes.
- init
Character {"full", "random"}: Region each expert starts from.
- min_region_size
Integer [1, Inf): Fewest cases an expert's region may hold before the expert keeps its previous fit instead of being refitted.
- expand_search_spaces
Logical: If TRUE, expand a base learner's search space into one expert per combination.
- ifw
(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.
Details
The model is sum_k 1\{o(x) = k\} F_k(x): an "oracle" o assigns each case to
one of the K "experts" F_k, and that expert predicts it. Oracle and experts
are fitted by alternating, in the manner of k-means: with the experts fixed,
the oracle minimizes the total loss, which reduces to a weighted K-class
classification over an extended dataset holding each case once per expert; with
the oracle fixed, each expert is refitted on the cases assigned to it. The
losses are cross-validated throughout, so an expert is never scored on a case
it was trained on.
The oracle is a classifier over the original covariates whatever the outcome is, so with more than two experts it must handle more than two classes. Its variable importance – which covariates decide which model applies – is what get_varimp returns for a fitted model, and a simple oracle such as setup_CART makes the partition itself readable.
Supports regression and binary classification.
Reference: Valdes, Interian, Gennatas & van der Laan, "Conditional Super Learner", IEEE Transactions on Pattern Analysis and Machine Intelligence (2022). doi:10.1109/TPAMI.2021.3131976
Examples
csl_hyperparams <- setup_ConditionalSuperLearner(
base_learners = list(setup_GLM(), setup_CART())
)
csl_hyperparams
#> <ConditionalSuperLearnerHyperparameters>
#> hyperparameters:
#> base_learners: <chr> GLM, CART
#> meta_learner: <chr> Ranger
#> inner_resampling_config: <chr> 10 independent folds
#> expand_search_spaces: <lgc> TRUE
#> ifw: <lgc> FALSE
#> n_iterations: <int> 4
#> loss: <NUL> NULL
#> init: <chr> full
#> min_region_size: <int> 10
#> tunable_hyperparameters: <chr> ifw, n_iterations
#> fixed_hyperparameters: <chr> base_learners, meta_learner, inner_resampling_config, expand_search_spaces, loss, init, min_region_size
#> tuned: <int> -1
#> resampled: <int> 0
#> n_workers: <int> 1