R/extract_importance_mean.R
extract_importance_mean.Rd
Extract the individual-algorithm extrinsic importance from a mean object, along with the importance rank.
extract_importance_mean(fit = NULL, feature_names = "", coef = 0)
the mean
object.
the feature names
the Super Learner coefficient associated with the learner.
a tibble, with columns algorithm
(the fitted algorithm),
feature
(the feature), importance
(the algorithm-specific
extrinsic importance of the feature), rank
(the feature importance
rank, with 1 indicating the most important feature), and weight
(the algorithm's weight in the Super Learner)
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 mean outcome
fit <- mean(y)
# extract importance
importance <- extract_importance_mean(fit = fit, feature_names = feature_nms)
importance
#> # A tibble: 22 × 5
#> algorithm feature importance rank weight
#> <chr> <chr> <lgl> <dbl> <dbl>
#> 1 mean institution NA 11.5 0
#> 2 mean lab1_actb NA 11.5 0
#> 3 mean lab1_molecules_score NA 11.5 0
#> 4 mean lab1_telomerase_score NA 11.5 0
#> 5 mean lab2_fluorescence_score NA 11.5 0
#> 6 mean lab3_muc3ac_score NA 11.5 0
#> 7 mean lab3_muc5ac_score NA 11.5 0
#> 8 mean lab4_areg_score NA 11.5 0
#> 9 mean lab4_glucose_score NA 11.5 0
#> 10 mean lab5_mucinous_call NA 11.5 0
#> # ℹ 12 more rows