input_uncertainty¶
Python reference for nagasim.uncertainty.input_uncertainty.
Each KPI's run-to-run interval, its interval with the inputs' uncertainty, and the inputs' share of the spread.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layout
|
dict or str
|
The model. |
required |
inputs
|
list of dict
|
|
required |
kpis
|
list of str
|
|
None
|
resamples
|
int
|
Bootstrap resamples (at least 2) and replications per model (at least 2); the
model runs |
20
|
replications
|
int
|
Bootstrap resamples (at least 2) and replications per model (at least 2); the
model runs |
20
|
seed
|
int
|
Replication r of every run uses |
0
|
overrides
|
list of dict
|
A change ( |
None
|
Returns:
| Type | Description |
|---|---|
dict
|
|
See Also
nagasim.inputfit.best_fit : Fits the distribution a sample comes from. nagasim.experiments.run_scenarios : Compares scenarios without input uncertainty. input_uncertainty_frame : The same answer as a DataFrame, one row per KPI.
Examples:
>>> import random
>>> from nagasim import build as nb, uncertainty
>>> m = nb.Model(time_limit=300, warmup=30)
>>> m.add_resource(name="Server", capacity=1)
'Server'
>>> arrive = m.create("arrive", distribution=nb.Exponential(rate=0.9))
>>> _ = arrive >> m.process("serve", resource_name="Server",
... distribution=nb.Exponential(rate=1.0)) >> m.dispose()
>>> rng = random.Random(0)
>>> gaps = [round(rng.expovariate(0.9), 3) for _ in range(30)]
>>> out = uncertainty.input_uncertainty(
... m.to_dict(), [{"path": "blocks.arrive.params.distribution", "values": gaps}],
... kpis=["system/Total Entities Completed"], resamples=2, replications=2)
>>> out["runs"], out["completed"]
(6, True)
>>> sorted(out["kpis"][0])
['input_interval', 'input_share', 'kpi', 'mean', 'resamples_used', 'run_ci']