Skip to content

Commit

Permalink
Minor updates to pbias API docstring (#655)
Browse files Browse the repository at this point in the history
* Updates to pbias API docstrings
---------

Signed-off-by: Stephanie Chong <[email protected]>
Co-authored-by: Tennessee Leeuwenburg <[email protected]>
  • Loading branch information
Steph-Chong and tennlee authored Sep 6, 2024
1 parent 5a76797 commit 43b2bd9
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/scores/continuous/standard_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,13 @@ def pbias(
"""
Calculates the percent bias, which is the ratio of the additive bias to the mean observed value, multiplied by 100.
Percent bias is used for evaluating and comparing forecast accuracy across stations or dataset with varying magnitudes.
By expressing the error as a percentage of the observed value, it allows for standardized comparisons, enabling assessment
of forecast performance regardless of the absolute scale of values. Like multiplicative_bias, Percent bias will return a np.inf
where the mean of `obs` across the dims to be reduced is 0.
It is defined as
Percent bias is used for evaluating and comparing forecast accuracy across stations or datasets with varying magnitudes.
By expressing the error as a percentage of the observed value, it allows for standardised comparisons, enabling assessment
of forecast performance regardless of the absolute scale of values. Like :py:func:`scores.continuous.multiplicative_bias`,
``pbias`` will return a ``np.inf`` where the mean of ``obs`` across the dims to be reduced is 0. It is defined as
.. math::
\\text{Percent bias} = 100 * \\frac{\\sum_{i=1}^{N}(x_i - y_i)}{\\sum_{i=1}^{N} y_i}
\\text{Percent bias} = 100 \\cdot \\frac{\\sum_{i=1}^{N}(x_i - y_i)}{\\sum_{i=1}^{N} y_i}
where:
- :math:`x_i` = the values of x in a sample (i.e. forecast values)
Expand All @@ -373,9 +372,9 @@ def pbias(
fcst: Forecast or predicted variables.
obs: Observed variables.
reduce_dims: Optionally specify which dimensions to reduce when
calculating the percentage additive bias. All other dimensions will be preserved.
calculating the percent bias. All other dimensions will be preserved.
preserve_dims: Optionally specify which dimensions to preserve when
calculating the additive bias percentage. All other dimensions will be reduced. As a
calculating the percent bias. All other dimensions will be reduced. As a
special case, 'all' will allow all dimensions to be preserved. In
this case, the result will be in the same shape/dimensionality
as the forecast, and the errors will be the error at each
Expand All @@ -393,7 +392,7 @@ def pbias(
Water Resources Research, 29(4), 1185-1194. https://doi.org/10.1029/92WR02617
- Alfieri, L., Pappenberger, F., Wetterhall, F., Haiden, T., Richardson, D., & Salamon, P. (2014).
Evaluation of ensemble streamflow predictions in Europe. Journal of Hydrology, 517, 913-922.
http://dx.doi.org/10.1016/j.jhydrol.2014.06.035
http://doi.org/10.1016/j.jhydrol.2014.06.035
- Dawson, C. W., Abrahart, R. J., & See, L. M. (2007). HydroTest:
A web-based toolbox of evaluation metrics for the standardised assessment of hydrological forecasts.
Environmental Modelling and Software, 22(7), 1034-1052.
Expand Down

0 comments on commit 43b2bd9

Please sign in to comment.