
How much does each group of features contribute?
Source:R/model_ablation.R
ablate_feature_groups.RdRefits a model with each named group of columns removed (or kept alone) in cross-validation and reports the change in AUROC, AUPRC and Brier score with a paired bootstrap interval. A group is any list of columns: RUCA/SDI, a site's Charlson index beside the standard one, velocity features. Only aggregate numbers are returned, so a site can send the result back.
Usage
ablate_feature_groups(
features,
outcome,
groups,
fit_predict = NULL,
mode = "drop",
folds = 5L,
n_boot = 200L,
ci_level = 0.95,
seed = 0
)Arguments
- features
A data frame with one numeric column per feature.
- outcome
0/1 outcome per row.
- groups
Named list: group name -> character vector of columns of
features.- fit_predict
function(x_train, y_train, x_test)returning probabilities; defaultridge_logistic_fit_predict().- mode
"drop","only"or"both".- folds
Cross-validation folds.
- n_boot
Bootstrap resamples.
- ci_level
Interval level.
- seed
Random seed (the caller's RNG state is restored).
Value
A data frame with one row per (mode, group) plus the full model (mode = "full"): n_features, n, events, and for
auroc, auprc, brier the columns *_full, *_variant, *_delta, *_delta_lo, *_delta_hi, *_p_boot.
Details
Groups may overlap; columns outside every group stay in all models. The full model is refit with each group removed (mode = "drop"),
kept alone together with the ungrouped columns ("only"), or both ("both"), on the same stratified folds, so every difference is paired.
Differences are without - full for "drop" (negative = the group helps for AUROC/AUPRC, positive for Brier) and only - full for
"only"; the interval is a paired bootstrap over patients of the out-of-fold predictions and p_boot is the two-sided share of
resamples on the other side of zero.