danieldux commited on
Commit
692721d
1 Parent(s): aca90be

Update test cases for hierarchical metrics

Browse files
Files changed (1) hide show
  1. tests.py +50 -2
tests.py CHANGED
@@ -27,6 +27,54 @@ test_cases = [
27
  "hierarchical_fmeasure": 0.588235294117647,
28
  },
29
  },
30
- # {"predictions": [1, 1], "references": [1, 1], "result": {"metric_score": 1}},
31
- # {"predictions": [1, 0], "references": [1, 1], "result": {"metric_score": 0.5}},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ]
 
27
  "hierarchical_fmeasure": 0.588235294117647,
28
  },
29
  },
30
+ {
31
+ "references": ["1111"],
32
+ "predictions": ["1111"],
33
+ "result": {
34
+ "accuracy": 1.0,
35
+ "hierarchical_precision": 1.0,
36
+ "hierarchical_recall": 1.0,
37
+ "hierarchical_fmeasure": 1.0,
38
+ },
39
+ },
40
+ {
41
+ "references": ["1111"],
42
+ "predictions": ["1112"],
43
+ "result": {
44
+ "accuracy": 0.0,
45
+ "hierarchical_precision": 0.75,
46
+ "hierarchical_recall": 0.75,
47
+ "hierarchical_fmeasure": 0.75,
48
+ },
49
+ },
50
+ {
51
+ "references": ["1111"],
52
+ "predictions": ["1120"],
53
+ "result": {
54
+ "accuracy": 0.0,
55
+ "hierarchical_precision": 0.5,
56
+ "hierarchical_recall": 0.5,
57
+ "hierarchical_fmeasure": 0.5,
58
+ },
59
+ },
60
+ {
61
+ "references": ["1111"],
62
+ "predictions": ["1211"],
63
+ "result": {
64
+ "accuracy": 0.0,
65
+ "hierarchical_precision": 0.25,
66
+ "hierarchical_recall": 0.25,
67
+ "hierarchical_fmeasure": 0.25,
68
+ },
69
+ },
70
+ {
71
+ "references": ["1111", "1111", "1111", "1111"],
72
+ "predictions": ["1111", "1112", "1120", "1211"],
73
+ "result": {
74
+ "accuracy": 0.25,
75
+ "hierarchical_precision": 1.0,
76
+ "hierarchical_recall": 0.4,
77
+ "hierarchical_fmeasure": 0.5714285714285715,
78
+ },
79
+ },
80
  ]