Skip to content

Commit

Permalink
noop
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 604694670
  • Loading branch information
genehwung authored and tfx-copybara committed Feb 6, 2024
1 parent 39565db commit 09d1fce
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,16 @@ def derive_metric(
self, metric: ConfusionMatrixMetric, average=None
) -> _NumbersT:
"""Helper to call the right metric function given a Metric Enum."""
match metric:
case ConfusionMatrixMetric.PRECISION:
result = _precision(self)
case ConfusionMatrixMetric.RECALL:
result = _recall(self)
case ConfusionMatrixMetric.F1_SCORE:
result = _f1(self)
case ConfusionMatrixMetric.ACCURACY:
result = _accuracy(self)
case _:
raise NotImplementedError(f'"{metric}" metric is not supported.')
if metric == ConfusionMatrixMetric.PRECISION:
result = _precision(self)
elif metric == ConfusionMatrixMetric.RECALL:
result = _recall(self)
elif metric == ConfusionMatrixMetric.F1_SCORE:
result = _f1(self)
elif metric == ConfusionMatrixMetric.ACCURACY:
result = _accuracy(self)
else:
raise NotImplementedError(f'"{metric}" metric is not supported.')
assert (
average != AverageType.SAMPLES
), 'Unexpected samplewise average for a derived metric.'
Expand Down

0 comments on commit 09d1fce

Please sign in to comment.