stats.errors.error_summary(errors, * , quantiles= (0.05 , 0.95 ))
Summarise the distribution of forecast errors, one column per entry.
For each entry the summary reports mean, median, the requested quantiles, standard deviation (ddof=1), minimum, and maximum — the row layout of a manuscript error-statistics table.
Parameters
errors
Mapping [str , pd .Series ]
Mapping of entry name to its error series (forecast - actual).
required
quantiles
tuple [float , …]
Quantile levels to include, each in (0, 1). Defaults to (0.05, 0.95).
(0.05, 0.95)
Returns
pd .DataFrame
pd.DataFrame: Indexed by statistic name
pd .DataFrame
(["mean", "median", *[f"q{q:g}"], "std", "min", "max"]), one
pd .DataFrame
column per entry, in mapping order.
Raises
TypeError
When an entry value is not a pd.Series.
ValueError
When errors is empty or a quantile is outside (0, 1).
Examples
import pandas as pd
from spotforecast2_safe.stats.errors import error_summary
errors = {"model" : pd.Series([- 2.0 , - 1.0 , 0.0 , 1.0 , 2.0 ])}
table = error_summary(errors)
print (table.round (2 ).to_string())
assert table.loc["mean" , "model" ] == 0.0
assert table.loc["min" , "model" ] == - 2.0
model
statistic
mean 0.00
median 0.00
q0.05 -1.80
q0.95 1.80
std 1.58
min -2.00
max 2.00