Skip to main content

RevenueRegressionScenario

Economics scenarios · Implementation: mlsysim/engine/scenario_definitions/economics.py.

Construct this scenario with keyword inputs. The fields below show the types and defaults declared by this class.

A metric regression that cuts revenue in proportion for undetected (or for alerted with an alert and containment); revenue is weekly_revenue per week.

Notes

Equation: Loss is relative_drop*weekly_revenue*(duration/one_week); shorter windows reduce it proportionally.

Assumptions: Constant revenue rate and a linear assumed revenue response to the metric regression.

Excludes: Demand elasticity, recovery lag, and causal identification of the metric-revenue relation.

References

Derivation: The scenario assumes revenue falls in direct proportion to relative_drop. A constant weekly revenue rate integrated over duration therefore loses relative_drop times revenue_rate times duration; an earlier alert changes only the exposure window.

Examples

>>> from mlsysim import Scenarios
>>> s = Scenarios.AggregationWindowRevenueIncident
>>> s.undetected_loss.to("USD").magnitude >= s.alerted_loss.to("USD").magnitude
True

Attributes

Name Description
alerted
alerted_loss Revenue loss in USD over the alert-and-containment window.
feature_mean_after
feature_mean_before
feature_shift Signed relative shift of the feature mean from its initial value.
freshness_slo
impact_reduction Dimensionless fraction of proportional loss avoided by the shorter detection window.
metric_after
metric_before
metric_change Signed relative change of the monitored metric from its initial value.
relative_drop
shift_threshold
undetected
undetected_loss Revenue loss in USD over the uncontained incident window.
weekly_revenue
window_ratio Dimensionless uncontained duration divided by the contained duration.

Methods

Name Description
loss Revenue lost in USD over the supplied duration at the assumed proportional drop.

loss

engine.scenario_types.RevenueRegressionScenario.loss(duration)

Revenue lost in USD over the supplied duration at the assumed proportional drop.

Equation: (relative_drop * weekly_revenue * (duration / Q_(1, 'week')).to('').magnitude).to('USD').

weekly_revenue

Type: Quantity.

Declared default: required.

relative_drop

Type: float.

Declared default: required.

metric_before

Type: float.

Declared default: required.

metric_after

Type: float.

Declared default: required.

undetected

Type: Quantity.

Declared default: required.

alerted

Type: Quantity.

Declared default: required.

feature_mean_before

Type: Optional[float].

Declared default: None.

feature_mean_after

Type: Optional[float].

Declared default: None.

freshness_slo

Type: Optional[Quantity].

Declared default: None.

shift_threshold

Type: Optional[float].

Declared default: None.

undetected_loss

engine.scenario_types.RevenueRegressionScenario.undetected_loss

Revenue loss in USD over the uncontained incident window.

Equation: loss(undetected).

alerted_loss

engine.scenario_types.RevenueRegressionScenario.alerted_loss

Revenue loss in USD over the alert-and-containment window.

Equation: loss(alerted).

window_ratio

engine.scenario_types.RevenueRegressionScenario.window_ratio

Dimensionless uncontained duration divided by the contained duration.

Equation: (undetected / alerted).to('').magnitude.

impact_reduction

engine.scenario_types.RevenueRegressionScenario.impact_reduction

Dimensionless fraction of proportional loss avoided by the shorter detection window.

Equation: 1 - (alerted / undetected).to('').magnitude.

metric_change

engine.scenario_types.RevenueRegressionScenario.metric_change

Signed relative change of the monitored metric from its initial value.

Equation: metric_after / metric_before - 1.

feature_shift

engine.scenario_types.RevenueRegressionScenario.feature_shift

Signed relative shift of the feature mean from its initial value.

Equation: (feature_mean_after - feature_mean_before) / feature_mean_before.

Back to top