Skip to content

Commit

Permalink
one more sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
grantbuster committed Mar 28, 2024
1 parent 03ef3b2 commit 226b67f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/bias/test_bias_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,13 @@ def test_match_zero_rate():
assert skill['bias_f1_zero_rate'] != skill['base_f1_zero_rate']
assert (bias_data == 0).mean() != (base_data == 0).mean()

bias_data = SkillAssessment._match_zero_rate(bias_data, base_data)
skill = SkillAssessment._run_skill_eval(bias_data, base_data, 'f1', 'f1')
skill = SkillAssessment._run_skill_eval(bias_data, base_data, 'f1', 'f1',
match_zero_rate=True)
assert (bias_data == 0).mean() == (base_data == 0).mean()
assert skill['bias_f1_zero_rate'] == skill['base_f1_zero_rate']
for p in (1, 5, 25, 50, 75, 95, 99):
assert np.allclose(skill[f'base_f1_percentile_{p}'],
np.percentile(base_data, p))

with tempfile.TemporaryDirectory() as td:
fp_nsrdb_temp = os.path.join(td, os.path.basename(FP_NSRDB))
Expand Down

0 comments on commit 226b67f

Please sign in to comment.