Skip to content

Commit

Permalink
fix error when calculating log loss
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasDrews97 committed May 4, 2024
1 parent f6fe948 commit d1a73ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hiclass/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def log_loss(
for level in range(make_leveled(y_true).shape[1]):
scores.append(_log_loss(classifier, y_true, y_prob[level], level))
return _aggregate_scores(scores, agg)
return _multiclass_brier_score(classifier, y_true, y_prob, level)
return _log_loss(classifier, y_true, y_prob, level)


def expected_calibration_error(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ def test_log_loss_single_level(uncertainty_data_multi_level):

log_loss_1 = log_loss(classifier, y_true, prob, level=1)
log_loss_2 = log_loss(classifier, y_true, [prob], level=1)
assert math.isclose(log_loss_1, 0.48793, abs_tol=1e-4)
assert math.isclose(log_loss_2, 0.48793, abs_tol=1e-4)
assert math.isclose(log_loss_1, 0.81349, abs_tol=1e-4)
assert math.isclose(log_loss_2, 0.81348, abs_tol=1e-4)


def test_local_expected_calibration_error(uncertainty_data):
Expand Down

0 comments on commit d1a73ac

Please sign in to comment.