Setup hyperparameters for the Conditional SuperLearner, which selects the best model from a library conditional on the covariates rather than combining them.
setup_ConditionalSuperLearner(
base_learners = list(setup_GLM(), setup_GLMNET(), setup_Ranger()),
meta_learner = setup_Ranger(),
inner_resampling_config = setup_KFold(n_resamples = 10L),
n_iterations = 4L,
loss = NULL,
init = "full",
min_region_size = 10L,
expand_search_spaces = TRUE,
ifw = FALSE
)ConditionalSuperLearnerHyperparameters object.
List of Hyperparameters objects: The experts. Names
label the regions and the reported region sizes; unnamed entries are named
after their algorithm.
Hyperparameters object: The oracle, a classifier fitted
on the extended dataset.
ResamplerConfig object: Cross-validation
scheme, which must hold out every case exactly once.
(Tunable) Integer [1, Inf): Alternations between fitting the oracle and refitting the experts.
Optional Character {"squared_error", "log_loss"}: Per-case loss the oracle minimizes.
Character {"full", "random"}: Region each expert starts from.
Integer [1, Inf): Fewest cases an expert's region may hold before the expert keeps its previous fit instead of being refitted.
Logical: If TRUE, expand a base learner's search space into one expert per combination.
(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.
EDG
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). tools:::Rd_expr_doi("10.1109/TPAMI.2021.3131976")
csl_hyperparams <- setup_ConditionalSuperLearner(
base_learners = list(setup_GLM(), setup_CART())
)
csl_hyperparams
Run the code above in your browser using DataLab