ControlledBranchScenario
Agents scenarios · Implementation: mlsysim/engine/scenario_definitions/agents.py.
Construct this scenario with keyword inputs. The fields below show the types and defaults declared by this class.
Fresh continuations from one saved prefix under several branches, counted by outcome; the Wilson bound a clean branch leaves and the clean runs a target_bound needs.
Notes
Equation: clean_runs_for_target is the worked quantity; each property below states its equation and units.
Assumptions: Each branch has a nonempty binomial outcome sample and the confidence target is supplied.
Excludes: Dependence between trials, multiple-comparison corrections, and evidence for unobserved branches.
References
Derivation: The scenario binds declared inputs to calc_wilson_clean_runs, calc_wilson_interval. Those implementations document their derivations and sources.
Examples
Execute the registered worked inputs; this is a modeled calculation.
>>> from mlsysim import Scenarios
>>> case = Scenarios.InterfaceRepairBranches
>>> value = case.clean_runs_for_target
>>> value
73Attributes
| Name | Description |
|---|---|
| accepted_class | |
| clean_runs_for_target | Failure-free run count needed for the target Wilson upper bound. |
| confidence | |
| outcomes | |
| target_bound | |
| z | Standard-normal quantile for the supplied two-sided confidence level. |
Methods
| Name | Description |
|---|---|
| acceptance_interval | Wilson interval for the named branch’s acceptance probability. |
| accepted | Accepted-run count for the named branch, zero when the accepted class is absent. |
| clean_failure_upper | Wilson failure-probability upper bound after the supplied number of failure-free runs. |
| failure_upper | Wilson upper bound for the named branch’s non-acceptance probability. |
| runs | Total observed runs in the named branch across all outcome classes. |
acceptance_interval
engine.scenario_types.ControlledBranchScenario.acceptance_interval(branch)Wilson interval for the named branch’s acceptance probability.
Wilson interval on the branch’s acceptance rate.
Equation: return calc_wilson_interval(self.accepted(branch), self.runs(branch), self.z)
accepted
engine.scenario_types.ControlledBranchScenario.accepted(branch)Accepted-run count for the named branch, zero when the accepted class is absent.
Equation: return self.outcomes[branch].get(self.accepted_class, 0)
clean_failure_upper
engine.scenario_types.ControlledBranchScenario.clean_failure_upper(runs)Wilson failure-probability upper bound after the supplied number of failure-free runs.
Wilson upper limit on the failure rate after runs clean runs.
Equation: return calc_wilson_interval(0, runs, self.z)[1]
failure_upper
engine.scenario_types.ControlledBranchScenario.failure_upper(branch)Wilson upper bound for the named branch’s non-acceptance probability.
Wilson upper limit on the branch’s non-acceptance rate.
Equation: n = self.runs(branch) return calc_wilson_interval(n - self.accepted(branch), n, self.z)[1]
runs
engine.scenario_types.ControlledBranchScenario.runs(branch)Total observed runs in the named branch across all outcome classes.
Equation: return sum(self.outcomes[branch].values())
outcomes
Type: Dict[str, Dict[str, int]].
Declared default: required.
accepted_class
Type: str.
Declared default: 'accepted'.
target_bound
Type: float.
Declared default: required.
confidence
Type: float.
Declared default: 0.95.
z
engine.scenario_types.ControlledBranchScenario.z
Standard-normal quantile for the supplied two-sided confidence level.
Equation: return NormalDist().inv_cdf(1 - (1 - self.confidence) / 2)
clean_runs_for_target
engine.scenario_types.ControlledBranchScenario.clean_runs_for_target
Failure-free run count needed for the target Wilson upper bound.
Equation: return calc_wilson_clean_runs(self.target_bound, self.z)