Skip to content

Commit daf82d6

Browse files
committed
Changed order of true/false to match manually calculated precision vals
1 parent 2a85e81 commit daf82d6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_metrics.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_f1score():
3535
def test_precision_case1():
3636
import torch
3737

38-
for boolean, true_precision in zip([True, False], [25.0 / 36, 7.0 / 10]):
38+
for boolean, true_precision in zip([False, True], [25.0 / 36, 7.0 / 10]):
3939
true1 = torch.tensor([0, 1, 2, 1, 0, 2, 1, 0, 2, 1])
4040
pred1 = torch.tensor([0, 2, 1, 1, 0, 2, 0, 0, 2, 1])
4141
P = Precision(3, micro_averaging=boolean)
@@ -48,7 +48,7 @@ def test_precision_case1():
4848
def test_precision_case2():
4949
import torch
5050

51-
for boolean, true_precision in zip([True, False], [8.0 / 15, 6.0 / 15]):
51+
for boolean, true_precision in zip([False, True], [8.0 / 15, 6.0 / 15]):
5252
true2 = torch.tensor([0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4])
5353
pred2 = torch.tensor([0, 0, 4, 3, 4, 0, 4, 4, 2, 3, 4, 1, 2, 4, 0])
5454
P = Precision(5, micro_averaging=boolean)
@@ -61,7 +61,7 @@ def test_precision_case2():
6161
def test_precision_case3():
6262
import torch
6363

64-
for boolean, true_precision in zip([True, False], [3.0 / 4, 4.0 / 5]):
64+
for boolean, true_precision in zip([False, True], [3.0 / 4, 4.0 / 5]):
6565
true3 = torch.tensor([0, 0, 0, 1, 0])
6666
pred3 = torch.tensor([1, 0, 0, 1, 0])
6767
P = Precision(2, micro_averaging=boolean)
@@ -74,7 +74,7 @@ def test_precision_case3():
7474
def test_for_zero_denominator():
7575
import torch
7676

77-
for boolean in [True, False]:
77+
for boolean in [False, True]:
7878
true4 = torch.tensor([1, 1, 1, 1, 1])
7979
pred4 = torch.tensor([0, 0, 0, 0, 0])
8080
P = Precision(2, micro_averaging=boolean)

0 commit comments

Comments
 (0)