Learn R Programming

rtemis (version 1.4.3)

setup_ModalityStacking: Setup ModalityStacking Hyperparameters

Description

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_KFold(n_resamples = 10L),
  discrete = FALSE,
  expand_search_spaces = TRUE,
  ifw = FALSE
)

Value

ModalityStackingHyperparameters object.

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 Hyperparameters objects, or one to use for every group: The library, named to match feature_groups.

meta_learner

Hyperparameters object: Learner fitted on the base learners' cross-validated predictions.

inner_resampling_config

ResamplerConfig object: 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.

Author

EDG

Details

With a wide x formed by concatenating modalities -- imaging, genomics, labs -- and few cases, one model per modality can outperform one model over all features, 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.

Two properties affect whether this outperforms one model over the concatenated modalities. 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

Run this code
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

Run the code above in your browser using DataLab