Spaces:
Build error
Build error
Add docstring to hierarchical_f_measure function
Browse files
ham.py
CHANGED
@@ -81,7 +81,17 @@ def calculate_hierarchical_precision_recall(
|
|
81 |
|
82 |
|
83 |
def hierarchical_f_measure(hP, hR, beta=1.0):
|
84 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
if hP + hR == 0:
|
86 |
return 0
|
87 |
return (beta**2 + 1) * hP * hR / (beta**2 * hP + hR)
|
|
|
81 |
|
82 |
|
83 |
def hierarchical_f_measure(hP, hR, beta=1.0):
|
84 |
+
"""
|
85 |
+
Calculate the hierarchical F-measure.
|
86 |
+
|
87 |
+
Parameters:
|
88 |
+
hP (float): The hierarchical precision.
|
89 |
+
hR (float): The hierarchical recall.
|
90 |
+
beta (float, optional): The beta value for F-measure calculation. Default is 1.0.
|
91 |
+
|
92 |
+
Returns:
|
93 |
+
float: The hierarchical F-measure.
|
94 |
+
"""
|
95 |
if hP + hR == 0:
|
96 |
return 0
|
97 |
return (beta**2 + 1) * hP * hR / (beta**2 * hP + hR)
|