Returns the top features that an ML model found to be important for predicting the AMR phenotype of a given pathogen.

extractTopFeats(fit, prop_vi_top_feats = c(0, 1), n_top_feats = NA)

Arguments

fit

Best model fit, such as the output of fitBestModel()

prop_vi_top_feats

pillar::num A vector of length 2 with elements together indicating the proportion of total variable importance the top features should comprise. To get the features that contribute to the top 10 to 20% of total variable importance, for example, set prop_vi_top_feats = c(0.1, 0.2). Returns all features by default.

n_top_feats

pillar::num Number of top features to extract

Value

A tibble with a column for top features (Variable), a column for Importance, and a column for Sign (or, for multi-class, a tibble with per-class columns of importance scores for each Variable)