-
Notifications
You must be signed in to change notification settings - Fork 46
Add bias to scores pandas api #992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
c3aec9b
581e824
65fe520
4253d27
5c14b3c
274cb5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ | |
| # pylint: disable=missing-function-docstring | ||
| # pylint: disable=line-too-long | ||
|
|
||
| import numbers | ||
|
|
||
| import numpy as np | ||
| import pandas as pd | ||
| import pytest | ||
|
|
@@ -121,3 +123,18 @@ def test_mae_dataframe(): | |
| result = scores.continuous.mae(df["fcst"], df["obs"]) | ||
| assert isinstance(result, float) | ||
| assert round(result, PRECISION) == expected | ||
|
|
||
|
|
||
| # Additive Bias (Mean Error) | ||
|
|
||
|
|
||
| def test_additive_bias_pandas_series(): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you're expanding the input types for For 100% test coverage you'll need to check the exception is correctly raised. Something like
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done the test
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @John-Sharples why do we need this in the pandas-specific API? Is the idea it's xarray plus pandas, or just pandas only?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My mistake, in putting it here it probably belongs in |
||
| fcst = pd.Series([1, 3, 1, 3, 2, 2, 2, 1, 1, 2, 3]) | ||
| obs = pd.Series([1, 1, 1, 2, 1, 2, 1, 1, 1, 3, 1]) | ||
|
|
||
| expected = 0.5455 | ||
|
|
||
| result = scores.continuous.additive_bias(fcst=fcst, obs=obs) | ||
|
|
||
| assert isinstance(result, numbers.Real) | ||
| assert round(float(result), PRECISION) == expected | ||
Uh oh!
There was an error while loading. Please reload this page.