2.5. Forecast scenarios

The example file predation.toml (shown below) defines all of details that are needed to generate forecasts. See the Key Concepts for further information.

Note

A single TOML file may contain multiple forecast scenarios. These can be used to generate separate forecasts for different time periods, locations, observation models, etc.

  1. The key components are defined in the [components] table:
    • The simulation model (model);
    • The time scale (time, either scalar time or date-time);
    • The prior distribution sampler (sampler, see pypfilt.sampler); and
    • The output recorder (summary).
  2. Prior distributions for each model parameter are defined in the [prior] table.
  3. Summary statistics to be recorded in the output file are defined in the [summary.monitors] and [summary.tables] tables.
  4. Various particle filter settings are defined in the [filter] table, including:
    • The number of particles (particles); and
    • The seed for the pseudo-random number generator (prng_seed).
  5. The simulation time scale and simulation period are defined in the [time] table.

It also defines a single forecast scenario in the [scenario.example] table, which contains:

  • A unique name to identify this scenario ("Example Scenario");
  • An observation model for \(x(t)\) observations ([scenario.example.observations.x] table); and
  • The observation model for \(y(t)\) observations ([scenario.example.observations.y] table).
The contents of predation.toml.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
[components]
model = "pypfilt.examples.predation.LotkaVolterra"
time = "pypfilt.Scalar"
sampler = "pypfilt.sampler.Independent"
summary = "pypfilt.summary.HDF5"

[time]
start = 0.0
until = 15.0
steps_per_unit = 1

[prior]
x = { name = "uniform", args.low = 0.5, args.high = 1.5 }
y = { name = "uniform", args.low = 0.2, args.high = 0.4 }
alpha = { name = "uniform", args.low = 0.6, args.high = 0.8 }
beta = { name = "uniform", args.low = 1.2, args.high = 1.4 }
gamma = { name = "uniform", args.low = 0.9, args.high = 1.1 }
delta = { name = "uniform", args.low = 0.9, args.high = 1.1 }

[summary]
save_history = true
metadata.packages = [ "matplotlib" ]

[summary.tables]
model_cints.component = "pypfilt.summary.ModelCIs"
model_cints.credible_intervals = [ 0, 50, 95 ]
forecasts.component = "pypfilt.summary.PredictiveCIs"
forecasts.credible_intervals = [ 0, 50, 95 ]

[filter]
particles = 1000
prng_seed = 42
history_window = -1
resample.threshold = 0.25
regularisation.enabled = true

[filter.regularisation.bounds]
x = { min = 0, max = 2 }
y = { min = 0, max = 2 }
alpha = { min = 0, max = 2}
beta = { min = 0, max = 2}
gamma = { min = 0, max = 2}
delta = { min = 0, max = 2}

[files]
input_directory = "."
output_directory = "."
delete_cache_file_before_forecast = true
delete_cache_file_after_forecast = true

[scenario.example]
name = "Example Scenario"

[scenario.example.observations.x]
model = "pypfilt.examples.predation.ObsModel"
file = "predation-counts-x.ssv"
parameters.sdev = 0.2
descriptor.format.sdev = "0.1f"
descriptor.name.sdev = "sdev"

[scenario.example.observations.y]
model = "pypfilt.examples.predation.ObsModel"
file = "predation-counts-y.ssv"
parameters.sdev = 0.2
descriptor.format.sdev = "0.1f"
descriptor.name.sdev = "sdev"