Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

A validated model audit

We now keep training, subgroup discovery, and subgroup validation separate. The classifier is fitted only on training rows. Candidate descriptions and numeric cut points are chosen only on discovery rows. The fixed candidates are then evaluated on validation rows.

The breast-cancer dataset is small, making this an executable teaching example. A result list with no significant subgroup is a valid outcome. The workflow does not guarantee a detectable model weakness.

1. Reserve the three roles

Training, discovery, validation: 227 171 171

The scaler is fitted inside the training pipeline, so audit rows do not set its mean or scale. Here the positive score corresponds to label 1, benign in this loader. Prediction scores are computed after fitting and are not descriptor attributes.

2. Define the search before viewing validation outcomes

We search a generalization-aware version of the weighted ROC AUC decrease. A small custom pruning filter ensures at least five negatives, complementing the built-in minimum-positive filter. Negative count is anti-monotone because a refinement cannot gain negatives.

Loading...

The generalization-aware quality rewards a description only to the extent that it improves on its generalizations’ weighted performance-drop scores. The table also includes the base score so that these quantities are not confused.

3. Test the fixed candidates

For this audit, class-stratified randomization asks whether the ranking is worse than in random validation subsets with the same size and class balance. The weighted size/balance factor is constant across each candidate’s null subsets.

Loading...

For the wrapper, the significance helper tests the underlying value (here the weighted AUC decrease), not the discovery-dependent generalization subtraction. An undefined validation AUC yields p-value one. This can happen even after discovery-count constraints, because validation covers contain different rows.

The 999 draws make a quick demonstration. A more precise study should choose the Monte Carlo budget before inspecting outcomes and account for the resolution of the selected p-value convention and correction.

4. Visualize and report accepted results

Tested candidates: 5; accepted after BY: 1
<Figure size 600x550 with 1 Axes>

If none passes, do not silently relax the threshold or rerun discovery until something does. The report can still document candidate descriptions and both discovery and validation effects as exploratory observations, labeled with their validation outcomes.

For an accepted subgroup, describe the counts of both classes, discovery and validation ROC AUC, reference AUC, quality definition, null model, number of draws, p-value convention, and correction. A local AUC drop does not identify a cause; it identifies a population in which ranking warrants investigation.

Design choices to revisit for real data

Random row splits assume a suitable sampling structure. If deployment involves new patients, later time periods, or unseen sites, use a split that reflects that structure and select appropriate randomization strata. The helpers implement row-based operations; the analyst must choose a design matching the question.

Experiment. Repeat the full procedure with PRAUCQF, deciding the new setup before reading its validation results. Compare which aspect of performance the two audits investigate, particularly when class balance changes.