CRPSSProvider#

class openstef_beam.evaluation.metric_providers.CRPSSProvider(*, quantiles: list[Quantile] | None = None, metric_name: str = 'CRPSS', reference_filtering: Filtering = <openstef_core.types.AvailableAt object>, context_length: timedelta = datetime.timedelta(days=14), minimum_coverage: float = 0.9, weight_scale_quantile: Quantile = 0.99, sample_weighter: SampleWeighter | None = None, reference_forecast_builder: ReferenceForecastBuilder = <function rolling_quantile_reference_forecast>)[source]

Bases: MetricProvider

CRPS skill score relative to a rolling-quantile reference forecast.

The reference forecast for a timestamp consists of the quantiles of the measurements in the context_length before its cutoff, where the cutoff follows from reference_filtering: AvailableAt gives the same cutoff as filter_by_available_at (e.g. D-1 06:00) and LeadTime gives a cutoff of timestamp - lead_time. Measurements are considered available at their own timestamp.

Example

>>> from openstef_core.types import LeadTime
>>> provider = CRPSSProvider(reference_filtering=LeadTime.from_string("PT48H"))
Parameters:
property metric_names: frozenset[str]

Declared metric names that this provider produces.

Override in subclasses to enable eager metric-name validation (e.g. in the hyperparameter tuner).

Overrides:

MetricProvider.metric_names

metric_name: str
reference_filtering: Filtering
context_length: timedelta
minimum_coverage: float
weight_scale_quantile: Quantile
sample_weighter: SampleWeighter | None
reference_forecast_builder: ReferenceForecastBuilder
reference_forecast(measurements: Series, index: DatetimeIndex, sample_interval: timedelta, quantiles: list[Quantile]) → ForecastDataset[source]

Build the configured reference forecast for the requested timestamps.

Parameters:
Return type:

ForecastDataset

__call__(subset: ForecastDataset, full_ground_truth: ForecastInputDataset | None = None) → dict[Union[Quantile, Literal['global']], dict[str, float]][source]

Compute global CRPSS against the reference forecast built from the ground truth.

Parameters:
Return type:

dict[Union[Quantile, Literal['global']], dict[str, float]]

Overrides:

MetricProvider.__call__

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': False, 'extra': 'ignore', 'protected_namespaces': ()}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].