Spaces:
Build error
Build error
Add example usage of calculate_hierarchical_precision_recall function
Browse files
ham.py
CHANGED
@@ -95,3 +95,11 @@ def hierarchical_f_measure(hP, hR, beta=1.0):
|
|
95 |
if hP + hR == 0:
|
96 |
return 0
|
97 |
return (beta**2 + 1) * hP * hR / (beta**2 * hP + hR)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
if hP + hR == 0:
|
96 |
return 0
|
97 |
return (beta**2 + 1) * hP * hR / (beta**2 * hP + hR)
|
98 |
+
|
99 |
+
|
100 |
+
# Example list usage:
|
101 |
+
# real_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)
|
105 |
+
# print(result)
|