
Check classification validation rank stability
Source:R/check-validation-stability.R
check_validation_stability.RdScore fitted binary classifiers on their shared testing split, then measure how well their score rankings survive a paired bootstrap. Each draw samples testing rows with replacement within outcome classes and uses those same rows for all models. Models are not refitted.
Usage
check_validation_stability(
.model_tbl,
.metric_fn = yardstick::roc_auc,
.n_boot = 25L,
.event_level = "first",
.seed = NULL
)Arguments
- .model_tbl
A fitted table from
fast_classification(). Use models fitted and evaluated on the same split. Unfitted entries are ignored.- .metric_fn
A binary probability metric with the interface of
yardstick::roc_auc(), returning one numeric.estimate.- .n_boot
A positive integer giving the number of bootstrap draws.
- .event_level
"first"or"second": the outcome factor level whose predicted probability is supplied to.metric_fn.- .seed
Optional integer seed. A supplied seed leaves the caller's RNG state unchanged.
Value
A numeric scalar: the mean Spearman correlation of the full testing
scores with the bootstrap scores. Undefined draws are omitted. Returns
NA_real_ when stability cannot be estimated, including when there are
fewer than two fitted models, either class is absent, or all full-sample
scores are tied. A non-finite full-sample metric or invalid testing
probabilities also make the result unavailable.