SL_stabs_fitfun {flevr}R Documentation

Wrapper for using Super Learner-based extrinsic selection within stability selection

Description

A wrapper function for Super Learner-based extrinsic variable selection within stability selection, using the stabs package.

Usage

SL_stabs_fitfun(x, y, q, ...)

Arguments

x

the features.

y

the outcome of interest.

q

the number of features to select on average.

...

other arguments to pass to SuperLearner.

Value

a named list, with elements: selected (a logical vector indicating whether or not each variable was selected); and path ( a logical matrix indicating which variable was selected at each step).

See Also

stabsel for general usage of stability selection.

Examples


data("biomarkers")
# subset to complete cases for illustration
cc <- complete.cases(biomarkers)
dat_cc <- biomarkers[cc, ]
# use only the mucinous outcome, not the high-malignancy outcome
y <- dat_cc$mucinous
x <- dat_cc[, !(names(dat_cc) %in% c("mucinous", "high_malignancy"))]
feature_nms <- names(x)
# use stability selection with SL (using small number of folds for CV, 
# small SL library and small number of bootstrap replicates for illustration only)
set.seed(20231129)
library("SuperLearner")
sl_stabs <- stabs::stabsel(x = x, y = y,
                           fitfun = SL_stabs_fitfun,
                           args.fitfun = list(SL.library = "SL.glm", cvControl = list(V = 2)),
                           q = 2, B = 5, PFER = 5)
sl_stabs


[Package flevr version 0.0.4 Index]