teehr.ProbabilisticMetrics#
- class teehr.ProbabilisticMetrics[source]#
Bases:
object
Define and customize probalistic metrics.
Notes
Probabilistic metrics compare a value against a distribution of predicted values, such as ensemble forecasts. Available probabilistic metrics include:
CRPS (Continuous Ranked Probability Score)
Methods
- class CRPS(*, return_type: str | ~pyspark.sql.types.ArrayType | ~pyspark.sql.types.MapType = None, unpack_results: bool = False, unpack_function: ~typing.Callable = None, estimator: ~teehr.models.metrics.basemodels.CRPSEstimators = 'pwm', backend: str = 'numba', output_field_name: str = 'mean_crps_ensemble', func: ~typing.Callable = <function create_crps_func>, summary_func: ~typing.Callable | None = None, input_field_names: str | ~teehr.models.str_enum.StrEnum | ~typing.List[str | ~teehr.models.str_enum.StrEnum] = ['primary_value', 'secondary_value', 'value_time'], attrs: ~typing.Dict = {'category': MetricCategories.Probabilistic, 'display_name': 'Continuous Ranked Probability Score - Ensemble', 'optimal_value': 0.0, 'short_name': 'crps_ensemble', 'value_range': [None, None]})#
Bases:
ProbabilisticBasemodel
Continous Ranked Probability Score - Ensemble.
- Parameters:
estimator (
str
) – CRPS estimator, can be (“pwm”, “nrg”, or “fair”). Default is “pwm”.backend (
str
) – The backend to use, by default “numba”. Can be (“numba” or “numpy”).summary_func (
Callable
) – The function to apply to the results, by default np.mean.output_field_name (
str
) – The output field name, by default “mean_crps_ensemble”.func (
Callable
) – The function to apply to the data, by defaultprobabilistic_funcs.ensemble_crps()
.input_field_names (
Union[str
,StrEnum
,List[Union[str
,StrEnum]]]
) – The input field names, by default [“primary_value”, “secondary_value”, “value_time”].attrs (
Dict
) – The static attributes for the metric.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'validate_assignment': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].