Skip to content

forecast

Python reference for nagasim.forecast.forecast.

Run a short terminating horizon from the system's current state.

There is no warm-up: a forecast is about the transient from the initial state, which a warm-up would discard.

Parameters:

Name Type Description Default
layout dict or str

The model, with its initial_state if it has one.

required
horizon float

Run length in base time units.

required
replications int

Replications behind each band.

100
kpis list of str

Narrows the end-of-horizon table (default: every KPI, including the timeseries/<series>/max and /min peaks).

None
events sequence of dict

{"name", "kpi", "op", "value"} conditions, each answered as a probability with a Wilson interval.

()
bind_data bool

Resolve the model's data bindings once before the replications, so the run uses today's parameters.

True
base_dir optional

As in nagasim.api.run_model.

None
network optional

As in nagasim.api.run_model.

None
confine_to optional

As in nagasim.api.run_model.

None
seed int

Seed of replication 0.

0
workers int or 'auto'

Process-pool size.

1
confidence float

Level of the intervals.

0.95
quantiles tuple of float

The band's lower and upper quantile.

(0.05, 0.95)
on_progress callable

As in nagasim.api.run_model.

None
should_stop callable

As in nagasim.api.run_model.

None

Returns:

Type Description
ForecastResult

The end-of-horizon kpis with intervals, the bands of each series and the answered events.

See Also

nagasim.api.run_model : A steady-state run, with a warm-up.

Examples:

>>> from pathlib import Path
>>> import nagasim
>>> from nagasim.forecast import forecast
>>> path = Path(nagasim.__file__).parent / "models" / "single_server.json"
>>> result = forecast(str(path), horizon=50, replications=5, seed=0)
>>> result.horizon, result.replications
(50.0, 5)