Update hierarchical precision, recall, and F1 calculation
Browse files
ham.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
"""This module provides functions for calculating hierarchical precicion, recall and
|
2 |
|
3 |
from typing import List, Set, Dict, Tuple
|
4 |
|
@@ -98,7 +98,7 @@ def hierarchical_f_measure(hP, hR, beta=1.0):
|
|
98 |
|
99 |
|
100 |
# Example list usage:
|
101 |
-
#
|
102 |
# predicted_codes = ["1111", "1113", "1120", "1211"]
|
103 |
# hierarchy_dict = {'1111': {'111', '1', '11'}, '1112': {'111', '1', '11'}, '1113': {'111', '1', '11'}, '1114': {'111', '1', '11'} ...}
|
104 |
# result = calculate_hierarchical_precision_recall(real_codes, predicted_codes, hierarchy_dict)
|
|
|
1 |
+
"""This module provides functions for calculating hierarchical variants of precicion, recall and F1."""
|
2 |
|
3 |
from typing import List, Set, Dict, Tuple
|
4 |
|
|
|
98 |
|
99 |
|
100 |
# Example list usage:
|
101 |
+
# reference_codes = ["1111", "1112", "1113", "1114"]
|
102 |
# predicted_codes = ["1111", "1113", "1120", "1211"]
|
103 |
# hierarchy_dict = {'1111': {'111', '1', '11'}, '1112': {'111', '1', '11'}, '1113': {'111', '1', '11'}, '1114': {'111', '1', '11'} ...}
|
104 |
# result = calculate_hierarchical_precision_recall(real_codes, predicted_codes, hierarchy_dict)
|