| extract_importance_SL {flevr} | R Documentation | 
Extract extrinsic importance from a Super Learner object
Description
Extract the individual-algorithm extrinsic importance from each fitted algorithm within the Super Learner; compute the average weighted rank of the importance scores, with weights specified by each algorithm's weight in the Super Learner.
Usage
extract_importance_SL(fit, feature_names, import_type = "all", ...)
Arguments
| fit | the fitted Super Learner ensemble | 
| feature_names | the names of the features | 
| import_type | the level of granularity for importance:  | 
| ... | other arguments to pass to individual-algorithm extractors. | 
Value
a tibble, with columns feature (the feature) and
rank (the weighted feature importance rank, with 1 indicating the
most important feature).
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)
# get the fit (using a simple library and 2 folds for illustration only)
set.seed(20231129)
library("SuperLearner")
fit <- SuperLearner::SuperLearner(Y = y, X = x, SL.library = c("SL.glm", "SL.mean"), 
                                  cvControl = list(V = 2))
# extract importance using all learners
importance <- extract_importance_SL(fit = fit, feature_names = feature_nms)
importance
# extract importance of best learner
best_importance <- extract_importance_SL(fit = fit, feature_names = feature_nms, 
                                         import_type = "best")
best_importance
[Package flevr version 0.0.4 Index]