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:
MetricProviderCRPS 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_lengthbefore its cutoff, where the cutoff follows fromreference_filtering:AvailableAtgives the same cutoff asfilter_by_available_at(e.g. D-1 06:00) andLeadTimegives a cutoff oftimestamp - 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:
metric_name (
str)reference_filtering (
AvailableAt|LeadTime)context_length (
timedelta)minimum_coverage (
float)weight_scale_quantile (
Quantile)sample_weighter (
SampleWeighter|None)reference_forecast_builder (
Callable[...,ForecastDataset])
- 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:
measurements (
Series)index (
DatetimeIndex)sample_interval (
timedelta)
- Return type:
- __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:
subset (
ForecastDataset)full_ground_truth (
ForecastInputDataset|None)
- Return type:
- 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].