Skip to content

Commit

Permalink
Merge pull request #620 from tennlee/brier_docstring_niceness
Browse files Browse the repository at this point in the history
Improve brier score docstring rendering
  • Loading branch information
tennlee authored Aug 10, 2024
2 parents e261908 + 790d4d4 commit d277849
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/scores/probability/brier_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ def brier_score(
Calculates the Brier score for forecast and observed data. For an explanation of the
Brier score, see https://en.wikipedia.org/wiki/Brier_score.
.. math::
\\text{brier score} = \\frac{1}{n} \\sum_{i=1}^n (\\text{forecast}_i - \\text{observed}_i)^2
If you want to speed up performance with Dask and are confident of your input data,
or if you want observations to take values between 0 and 1, set `check_inputs` to `False`.
or if you want observations to take values between 0 and 1, set ``check_args`` to ``False``.
Args:
fcst: Forecast or predicted variables in xarray.
Expand All @@ -41,9 +44,10 @@ def brier_score(
forecast and observed dimensions must match precisely.
weights: Optionally provide an array for weighted averaging (e.g. by area, by latitude,
by population, custom)
check_args: will perform some tests on the data if set to True
Raises:
ValueError: if `fcst` contains non-nan values outside of the range [0, 1]
ValueError: if `obs` contains non-nan values not in the set {0, 1}
ValueError: if ``fcst`` contains non-nan values outside of the range [0, 1]
ValueError: if ``obs`` contains non-nan values not in the set {0, 1}
"""
if check_args:
error_msg = ValueError("`fcst` contains values outside of the range [0, 1]")
Expand Down

0 comments on commit d277849

Please sign in to comment.