skill_score#
- openstef_beam.metrics.skill_score(score: float, reference_score: float, *, as_percentage: bool = True) float[source]#
Calculate the skill of a score relative to a reference score.
A skill score expresses how much better a forecast is than a reference forecast. It is only meaningful for non-negative metrics where lower values are better, such as CRPS or MAE.
Interpretation:
Equal to the reference: 0
Perfect forecast (score of 0): 1 (or 100%)
Twice as accurate as the reference: 0.5 (or 50%)
Worse than the reference: negative
- Parameters:
- Return type:
- Returns:
The skill score. Returns NaN if either input is NaN or if the reference score is zero.
Example
Compare a forecast against a reference forecast
>>> skill_score(0.5, 1.0) 50.0 >>> skill_score(1.0, 1.0) 0.0 >>> skill_score(2.0, 1.0) -100.0 >>> skill_score(0.5, 1.0, as_percentage=False) 0.5