dpyverification.scores.categorical#

Categorical scores, based on a 2x2 contingency table.

For verification of non-probabilistic forecasts, and historical simulations of discrete variables.

For references, see: https://scores.readthedocs.io/en/stable/included.html#categorical.

Functions

create_binary_array(data, thresholds, operator)

Given data and thresholds, compute the binary events.

Classes

CategoricalScores(config)

Categorical scores, based on the 2x2 contingency table.

CategoricalScoresConfig(*[, reduce_dims, ...])

Config to compute categorical scores, based on an event definition.

class dpyverification.scores.categorical.CategoricalScores(config)[source]#

Categorical scores, based on the 2x2 contingency table.

For reference: https://scores.readthedocs.io/en/stable/included.html#categorical

Parameters:

config (CategoricalScoresConfig)

kind: str = 'categorical_scores'#
config_class#

alias of CategoricalScoresConfig

supported_data_types: ClassVar[set[DataType]] = {DataType.simulated_forecast_single}#
compute_score_for_single_event(obs, sim, thresholds, event)[source]#

Compute any number of categorical scores for a single event.

Parameters:
Return type:

Dataset | DataArray

class dpyverification.scores.categorical.CategoricalScoresConfig(*, reduce_dims=<factory>, score_adapter, general, verification_pair_ids=[], events, scores, return_contingency_table=True, **extra_data)[source]#

Config to compute categorical scores, based on an event definition.

Parameters:
score_adapter: Literal[ScoreKind.categorical_scores]#
scores: Annotated[list[SupportedCategoricalScores], FieldInfo(annotation=NoneType, required=True, description='For reference, see: https://scores.readthedocs.io/en/stable/api.html#module-scores.categorical.')]#
events: Annotated[list[ThresholdEvent], FieldInfo(annotation=NoneType, required=True, description="A list of threshold event definitions. For each event, a categorical score will be computed. A threshold event is defined by a threshold and an operator. The threshold is a string that corresponds to a threshold id defined in the configuration. The operator defines how the threshold is applied to the data to create the event. For example, if the threshold is '10' and the operator is 'greater_than', the event will be created by applying the operator to the data and the threshold, i.e. data > 10. ")]#
return_contingency_table: Annotated[bool, FieldInfo(annotation=NoneType, required=True, description='Whether to return the contingency table in the output.')]#
dpyverification.scores.categorical.create_binary_array(data, thresholds, operator)[source]#

Given data and thresholds, compute the binary events.

Parameters:
Return type:

DataArray