Skip to content

Commit c401745

Browse files
committed
Format with black
1 parent dda9e1c commit c401745

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

hiclass/metrics.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ def _recall_macro(y_true: np.ndarray, y_pred: np.ndarray):
211211
return _compute_macro(y_true, y_pred, _recall_micro)
212212

213213

214-
def f1(y_true: np.ndarray, y_pred: np.ndarray, average: str = "micro", zero_division: str = "warn"):
214+
def f1(
215+
y_true: np.ndarray,
216+
y_pred: np.ndarray,
217+
average: str = "micro",
218+
zero_division: str = "warn",
219+
):
215220
r"""
216221
Compute hierarchical f-score.
217222
@@ -311,13 +316,19 @@ def _f_score_macro(y_true: np.ndarray, y_pred: np.ndarray, zero_division):
311316
return _compute_macro(y_true, y_pred, _f_score_micro, zero_division)
312317

313318

314-
def _compute_macro(y_true: np.ndarray, y_pred: np.ndarray, _micro_function, zero_division=None):
319+
def _compute_macro(
320+
y_true: np.ndarray, y_pred: np.ndarray, _micro_function, zero_division=None
321+
):
315322
overall_sum = 0
316323
for ground_truth, prediction in zip(y_true, y_pred):
317324
if zero_division:
318-
sample_score = _micro_function(np.array([ground_truth]), np.array([prediction]), zero_division)
325+
sample_score = _micro_function(
326+
np.array([ground_truth]), np.array([prediction]), zero_division
327+
)
319328
else:
320-
sample_score = _micro_function(np.array([ground_truth]), np.array([prediction]))
329+
sample_score = _micro_function(
330+
np.array([ground_truth]), np.array([prediction])
331+
)
321332
overall_sum = overall_sum + sample_score
322333
return overall_sum / len(y_true)
323334

0 commit comments

Comments
 (0)