forecast_from_state¶
Python reference for nagasim.twin.forecast_from_state.
The default runner: horizon from the clock the model's state starts at.
The parameters are the model's own: nothing is bound from live data inside a forecast.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
dict
|
The model with a state as its |
required |
horizon
|
float
|
How far to look ahead of the state's clock, in model time units. |
required |
replications
|
int
|
Replications of the forecast. |
required |
seed
|
int
|
The seed of the first replication. |
required |
workers
|
int or str
|
Worker processes, as |
required |
should_stop
|
callable or None
|
Asked between replications; true ends the forecast early. |
required |
base_dir
|
str or Path
|
The folder relative paths in the model resolve against. |
None
|
Returns:
| Type | Description |
|---|---|
ForecastResult
|
The forecast, as |
See Also
nagasim.forecast.forecast : What it calls. nagasim.twin.read_result : Reads the result a twin writes.
Examples:
>>> from pathlib import Path
>>> import nagasim
>>> from nagasim import state, twin
>>> path = Path(nagasim.__file__).parent / "models" / "single_server.json"
>>> model, _ = state.start(str(path), state.take(str(path), at=50.0))
>>> fc = twin.forecast_from_state(model, horizon=100, replications=2, seed=0,
... workers=1, should_stop=None)
>>> type(fc).__name__
'ForecastResult'