DensityScore.compute#
- DensityScore.compute()[source]#
Evaluate every score.
The CRPS is computed on every
(horizon, series)column at once by flattening the sample to(n_draws, h * k); the energy score once per horizon on the(n_draws, k)joint sample; the log score through_kernel_log_score(); and the point losses from the sample mean (squared error) and median (absolute error). Deterministic: nothing here draws.- Return type:
- Returns:
The
DensityScoreResult.
Example
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> paths, outcome = rng.standard_normal((2000, 4, 2)), rng.standard_normal((4, 2)) >>> record = DensityScore(paths, outcome, names=("gdp", "cpi")).compute() >>> record.names, record.crps.shape, record.energy.shape, record.n_draws (('gdp', 'cpi'), (4, 2), (4,), 2000) >>> bool(np.allclose(record.squared_error, (paths.mean(axis=0) - outcome) ** 2)) True