Setup hyperparameters for modality stacking: a SuperLearner whose base learners each see one group of features.
Usage
setup_ModalityStacking(
feature_groups = NULL,
base_learners = list(setup_GLM(), setup_GLMNET(), setup_Ranger()),
meta_learner = setup_NNLS(),
inner_resampling_config = setup_Resampler(n_resamples = 10L, type = "KFold"),
discrete = FALSE,
expand_search_spaces = TRUE,
ifw = FALSE
)Arguments
- feature_groups
Optional List: Features each base learner sees, as a named list of character vectors keyed by base learner name. Required by train.
- base_learners
List of
Hyperparametersobjects, or one to use for every group: The library, named to matchfeature_groups.- meta_learner
Hyperparametersobject: Learner fitted on the base learners' cross-validated predictions.- inner_resampling_config
ResamplerConfigobject: Cross-validation scheme used to build the level-one predictions.- discrete
(Tunable) Logical: If TRUE, keep the single lowest-risk library entry rather than the weighted combination.
- expand_search_spaces
Logical: If TRUE, expand a base learner's search space into one library entry per combination.
- ifw
(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.
Details
With a wide x formed by concatenating modalities – imaging, genomics, labs
– and few cases, one model per modality can beat one model over everything,
and each modality can take the algorithm that suits it: SPLS for correlated
blocks, LASSO for sparse ones, gradient boosting for interactions. Training is
otherwise identical to setup_SuperLearner: cross-validated predictions from
each base learner, combined by the meta learner.
feature_groups maps each base learner's name to the features it sees. Pass
a single Hyperparameters object as base_learners to use the same algorithm
on every group.
Whether this beats one model over the concatenated modalities is the empirical
question it exists to answer, and two things decide it. Each base learner sees
only its own group, so what every other modality contributes to the outcome
is irreducible noise to it, which can hide a real signal in a weak modality
behind a strong one. And the default meta learner returns a convex
combination, which averages the modalities rather than adding them: where they
are complementary rather than competing, meta_learner = setup_NNLS(normalize = FALSE) lets their contributions sum.
feature_groups is checked against the training data at train time, not at
setup: it names columns, and there is no data to name them in yet.
Supports regression and binary classification.
Examples
modality_hyperparams <- setup_ModalityStacking(
feature_groups = list(a = c("Sepal.Length", "Sepal.Width"), b = "Petal.Length"),
base_learners = list(a = setup_GLM(), b = setup_CART())
)
modality_hyperparams
#> <ModalityStackingHyperparameters>
#> hyperparameters:
#> base_learners: <chr> GLM, CART
#> meta_learner: <chr> NNLS
#> inner_resampling_config: <chr> 10 independent folds
#> expand_search_spaces: <lgc> TRUE
#> ifw: <lgc> FALSE
#> discrete: <lgc> FALSE
#> feature_groups:
#> a: <chr> Sepal.Length, Sepal.Width
#> b: <chr> Petal.Length
#> tunable_hyperparameters: <chr> ifw, discrete
#> fixed_hyperparameters: <chr> base_learners, meta_learner, inner_resampling_config, expand_search_spaces, feature_groups
#> tuned: <int> -1
#> resampled: <int> 0
#> n_workers: <int> 1