GaussianDriftScenario
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 continuous feature fitted as a normal at reference and now: KL divergence of the reference from the current fit.
Notes
Equation: The statistics helpers decompose and evaluate KL(reference || current); the trigger compares that value with a threshold.
Assumptions: Both feature distributions are Gaussian fits with positive standard deviations.
Excludes: Proof of concept drift, non-Gaussian tails, and calibration of the supplied trigger.
References
Derivation: The statistics helpers decompose and evaluate KL(reference || current); the trigger compares that value with a threshold. Individual property contracts identify the exact accounting expression or reusable calculation. Registry entries supply the scenario inputs; this class does not turn them into measured outcomes.
Examples
Evaluate a named scenario using its declared inputs.
>>> from mlsysim import Scenarios
>>> scenario = Scenarios.FraudAmountDrift
>>> round(float(scenario.kl_terms[0]), 4)
0.1671Attributes
| Name | Description |
|---|---|
| current_mean | |
| current_sd | |
| kl | Reference-to-current Gaussian KL divergence in nats, from calc_gaussian_kl. |
| kl_log_term | Dimensionless log-scale-ratio contribution to the Gaussian KL decomposition. |
| kl_ratio_term | Dimensionless variance-and-mean-shift contribution before subtracting one half in the KL |
| kl_terms | Log term, squared-error numerator, and variance denominator from |
| kl_trigger | |
| reference_mean | |
| reference_sd | |
| triggers | Whether the reference-to-current Gaussian KL divergence reaches the supplied trigger. |
reference_mean
Type: float.
Declared default: required.
reference_sd
Type: float.
Declared default: required.
current_mean
Type: float.
Declared default: required.
current_sd
Type: float.
Declared default: required.
kl_trigger
Type: Optional[float].
Declared default: None.
triggers
engine.scenario_types.GaussianDriftScenario.triggers
Whether the reference-to-current Gaussian KL divergence reaches the supplied trigger.
Equation: kl >= kl_trigger.
kl_terms
engine.scenario_types.GaussianDriftScenario.kl_terms
Log term, squared-error numerator, and variance denominator from calc_gaussian_kl_terms.
(log term, ratio numerator, ratio denominator) of the closed form.
Equation: calc_gaussian_kl_terms(reference_mean, reference_sd, current_mean, current_sd).
kl_log_term
engine.scenario_types.GaussianDriftScenario.kl_log_term
Dimensionless log-scale-ratio contribution to the Gaussian KL decomposition.
Equation: kl_terms[0].
kl_ratio_term
engine.scenario_types.GaussianDriftScenario.kl_ratio_term
Dimensionless variance-and-mean-shift contribution before subtracting one half in the KL formula.
Equation: _, num, den = kl_terms; result = num / den.
kl
engine.scenario_types.GaussianDriftScenario.kl
Reference-to-current Gaussian KL divergence in nats, from calc_gaussian_kl.
Equation: calc_gaussian_kl(reference_mean, reference_sd, current_mean, current_sd).