Trains on every site but one (optionally on a balanced sample), scores the held-out site at its natural prevalence,
maps the scores back to the natural incidence and reports discrimination, calibration and top-k performance with
bootstrap intervals. The model is the ridge logistic regression of ridge_logistic_fit_predict().
Usage
evaluate_loso_transport(
features_df,
site_col = "site_anon",
feature_cols = NULL,
label_col = "y",
balance_ratio = 1,
score_natural = TRUE,
calibration = "prior_shift",
n_bootstraps = 100L,
capacity_fractions = 0.1,
random_state = 20261104,
keep_predictions = FALSE,
l2 = 1
)Arguments
- features_df
data frame with the site column, the 0/1 label and numeric features.
- site_col
site column
- feature_cols
features (default: numeric columns other than label, site and ids/dates).
- label_col
label column
- balance_ratio
majority rows per minority row in training (1 = 50/50);
NULL= natural.- score_natural
score every row of the held-out site (
TRUE) or a balanced subsample (diagnostic only).- calibration
"prior_shift"(default),"platt","isotonic"or"none".platt/isotonicare fitted on the training sites' natural data scored by the model (in-sample for those rows).- n_bootstraps
bootstrap resamples for 95 percent intervals (0 = none).
- capacity_fractions
top-k shares flagged
- random_state
seed
- keep_predictions
keep row-level scores.
- l2
ridge penalty.
