Skip to main content

selection-fragility

Is your leaderboard winner real?

A model ranking can hinge on a handful of lucky periods. selection-fragility deletes the luckiest ones and tells you whether the winner survives — or flips.

Live demo →

Paste a leaderboard and watch the winner flip, right in your browser — no install.

API reference →

Every public function, generated from the installed package.

The Python package (selection-fragility) and the R package (selectionfragility) are behaviourally identical — the same inputs give bit-identical results.

60-second tour

Give it a table of per-period losses (one row per period, one column per model; lower is better). It returns a verdict, a leaderboard, and the two fragility numbers.

import selection_fragility as sf

# Per-period loss for three forecasters over ten weeks (lower is better).
losses = {
    "GRU":      [0.52, 0.49, 0.55, 0.47, 0.51, 0.18, 0.50, 0.53, 0.48, 0.52],
    "ARIMA":    [0.47, 0.46, 0.49, 0.45, 0.48, 0.46, 0.44, 0.47, 0.45, 0.46],
    "Seasonal": [0.55, 0.57, 0.54, 0.56, 0.53, 0.55, 0.58, 0.54, 0.56, 0.55],
}
labels = [f"W{i+1}" for i in range(10)]

panel = sf.LossPanel.from_losses(losses, labels=labels)
print(sf.report(panel))
VERDICT: not identified (MCS size 2 of 3)
  (see RESOLUTION below -- identification alone does not mean the edge is
   powered at this sample size)

LEADERBOARD
  ARIMA           mean=0.4630  in MCS     periods won=9 (champion)
  GRU             mean=0.4750  in MCS     periods won=1
  Seasonal        mean=0.5530  excluded   periods won=0

RESOLUTION
  observed edge 2.6% vs MDE@80% power 19.3% -- cannot determine at this sample size
  MCB bound: the champion's true edge over the binding rival is at most 18.6% (one-sided 95% upper bound) -- an upper limit only; it does NOT establish that a real edge exists (see VERDICT/RESOLUTION above).
  (RESOLUTION assumes no autocorrelation in the per-period loss differential;
   see ?resolution_report's Assumption section -- this is NOT checked at runtime)

PIVOT
  k*=2 of 10 periods (W3, W8) -- fragility read UNDETERMINED (not identified (MCS size > 1)); see VERDICT/RESOLUTION above before treating this as evidence either way

ARIMA tops the table — but the verdict is not identified: it sits in a statistical tie with GRU (MCS size 2), and deleting just 2 of 10 periods (W3, W8) hands the lead to GRU. A headline “ARIMA wins” would be overstating a coin-flip. The report says so itself in the RESOLUTION and PIVOT blocks — the tool is built to under-claim, not over-claim.

The two numbers that matter:

  • fragility(losses)["k_star"] — the fewest worst-case periods you must delete to flip the ranking’s #1. A small k* means the lead is thin.
  • the Model Confidence Set — the set of models that can’t be statistically separated from the best at the 95% level. A set larger than one means the top models are effectively tied.

What it measures

Output Meaning
Verdict identified (the winner is robust) or not identified (the lead depends on luck or is a statistical tie).
k* Fewest worst-case periods to delete before #1 changes. Reported with which periods.
Model Confidence Set Hansen, Lunde & Nason (2011): the 95% set of indistinguishable models.
Concentration How much of the winner’s lead rests on its best few periods.

The method is exact on AMIP’s linear-functional case (Giordano, Meager & Broderick 2023); the non-reducible addition is a calibrated null for dependent, vintaged data, transported to a model-selection decision. See Related work.

Install

pip install selection-fragility
import selection_fragility as sf

panel = sf.LossPanel.from_losses(losses, labels=weeks)
print(sf.report(panel))          # verdict + leaderboard
sf.fragility(losses)["k_star"]   # how many periods to flip the winner
install.packages("selectionfragility")

library(selectionfragility)
panel <- loss_panel(losses, labels = weeks)
report(panel)                    # verdict + leaderboard
fragility(losses)$k_star         # how many periods to flip the winner

Cite

selection-fragility is archived on Zenodo. Cite the version you used, or the concept DOI to always point at the latest:

GitHub’s Cite this repository button renders a ready-made BibTeX/APA entry from CITATION.cff.