feature.selection: Select top features by weighted mean SHAP (WMSHAP)

View source: R/feature.selection.R

feature.selectionR Documentation

Select top features by weighted mean SHAP (WMSHAP)

Description

Selects a subset of features from a shapley object. Features can be selected by: (1) specified 'features', (2) 'top_n_features', or (3) WMSHAP cutoff for "mean" or "lowerCI".

Usage

feature.selection(
  shapley,
  method = "lowerCI",
  cutoff = 0,
  top_n_features = NULL,
  features = NULL
)

Arguments

shapley

shapley object

method

Character. Specifies statistic used for thresholding. Either "mean" or "lowerCI" (default) should be specified. Ignored if 'top_n_features' is provided.

cutoff

Numeric. Cutoff for thresholding on 'method'. Default is zero, which means that all features with lower WMSHAP CI above zero will be selected.

top_n_features

Integer. If provided, selects the top N features by 'mean', overriding 'method' and 'cutoff'.

features

Character vector of features to keep. If provided, it is applied before 'top_n_features'/'cutoff' selection (i.e., selection happens within this set).

Value

A list with:

shapley

The updated shapley object.

features

Character vector of selected features, ordered by decreasing mean SHAP.

mean

Numeric vector of mean SHAP values aligned with 'features'.

Author(s)

E. F. Haghish


shapley documentation built on March 4, 2026, 9:06 a.m.