BinShareShiftScenario
Statistics scenarios · Implementation: mlsysim/engine/scenario_definitions/statistics.py.
Construct this scenario with keyword inputs. The fields below show the types and defaults declared by this class.
A feature binned at the training quantiles: training shares against recent shares, scored by PSI.
Notes
Equation: PSI = sum((current share - baseline share) * log(current share / baseline share)).
Assumptions: The lists refer to the same bins. Per-bin term access requires positive shares; the aggregate helper defines its own zero handling.
Excludes: Causal drift diagnosis, uncertainty intervals, and a universal PSI alert threshold.
References
Derivation: pSI = sum((current share - baseline share) * log(current share / baseline share)). The individual properties state units and intermediate accounting; this class introduces no fitted coefficient.
Examples
The named scenario supplies illustrative inputs; the output is calculated.
Attributes
| Name | Description |
|---|---|
| baseline_shares | |
| bins | |
| current_shares | |
| psi | Total dimensionless PSI from |
| terms | Per-bin PSI contributions, each current-minus-baseline share times log of their |
Methods
| Name | Description |
|---|---|
| ratio | Current share divided by baseline share for indexed bin i. |
| shares | Pair of baseline and current fractions for the named bin. |
| term | Dimensionless PSI contribution for the named bin, selected from terms. |
ratio
Current share divided by baseline share for indexed bin i.
Equation: return current_shares[i] / baseline_shares[i].
shares
Pair of baseline and current fractions for the named bin.
Equation: i = bins.index(name); return (baseline_shares[i], current_shares[i]).
term
Dimensionless PSI contribution for the named bin, selected from terms.
Equation: return terms[bins.index(name)].
baseline_shares
Type: List[float].
Declared default: required.
current_shares
Type: List[float].
Declared default: required.
bins
Type: Optional[List[str]].
Declared default: None.
terms
engine.scenario_types.BinShareShiftScenario.terms
Per-bin PSI contributions, each current-minus-baseline share times log of their ratio.
Equation: return [(c - b) * math.log(c / b) for b, c in zip(baseline_shares, current_shares)].
psi
engine.scenario_types.BinShareShiftScenario.psi
Total dimensionless PSI from physics.statistics.calc_population_stability_index.
Equation: return calc_population_stability_index(baseline_shares, current_shares).