Extract the individual-algorithm extrinsic importance from a glm object, along with the importance rank.

extract_importance_svm(
  fit = NULL,
  feature_names = "",
  coef = 0,
  x = NULL,
  y = NULL
)

Arguments

fit

the svm object.

feature_names

the feature names

coef

the Super Learner coefficient associated with the learner.

x

the features

y

the outcome

Value

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)

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 <- as.data.frame(dat_cc[, !(names(dat_cc) %in% c("mucinous", "high_malignancy"))])
x_mat <- as.matrix(x)
feature_nms <- names(x)
# get the fit 
set.seed(20231129)
fit <- kernlab::ksvm(x_mat, y)
# extract importance
importance <- extract_importance_svm(fit = fit, feature_names = feature_nms, x = x, y = y)
#> Warning: You are trying to do regression and your outcome only has two possible values Are you trying to do classification? If so, use a 2 level factor as your outcome column.
#> Loading required package: ggplot2
#> Loading required package: lattice
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: Variable(s) `' constant. Cannot scale data.
#> Warning: There were missing values in resampled performance measures.
importance
#> # A tibble: 22 × 5
#>    algorithm feature                        importance  rank weight
#>    <chr>     <chr>                               <dbl> <dbl>  <dbl>
#>  1 svm       lab3_muc3ac_score                   100       1      0
#>  2 svm       lab1_actb                            76.4     2      0
#>  3 svm       lab6_ab_score                        72.5     3      0
#>  4 svm       lab1_telomerase_score                58.8     4      0
#>  5 svm       lab4_glucose_score                   57.7     5      0
#>  6 svm       cea                                  45.7     6      0
#>  7 svm       lab1_telomerase_neoplasia_call       45.6     7      0
#>  8 svm       lab2_fluorescence_score              44.8     8      0
#>  9 svm       lab4_areg_score                      39.4     9      0
#> 10 svm       lab1_molecules_score                 30.6    10      0
#> # ℹ 12 more rows