-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from CallumWSimprints/fix-numpy-negation-bug
Bugfix: Update negation syntax in compute_ground_truth_statistics
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from confidenceinterval.delong import compute_ground_truth_statistics | ||
import numpy as np | ||
import pytest | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'ground_truth', | ||
[ | ||
(np.array([0,0,1,1,1])), # Values are integers | ||
(np.array([False, False, True, True, True])) # values are bools | ||
] | ||
) | ||
def test_compute_ground_truth_statistics(ground_truth): | ||
sample_weight = np.array([1,1,1,1,1]) | ||
|
||
expected_order = np.array([2,3,4,0,1]) | ||
expected_label_1_count = 3 | ||
expected_ordered_sample_weight = np.array([1,1,1,1,1]) | ||
|
||
order, label_1_count, ordered_sample_weight = compute_ground_truth_statistics(ground_truth=ground_truth, sample_weight=sample_weight) | ||
|
||
assert np.array_equal(expected_order, order) | ||
assert expected_label_1_count == label_1_count | ||
assert np.array_equal(expected_ordered_sample_weight, ordered_sample_weight) |