Skip to content

Commit

Permalink
Add "none" option to AveragePrecision (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkafteNicki committed Jun 28, 2022
1 parent d9c345b commit bdb3e59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -49,6 +49,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Skip box conversion if no boxes are present in `MeanAveragePrecision` ([#1097](https://github.com/Lightning-AI/metrics/pull/1097))


- Fixed inconsistency in docs and code when setting `average="none"` in `AvaragePrecision` metric ([#1116](https://github.com/Lightning-AI/metrics/pull/1116))


## [0.9.1] - 2022-06-08

### Added
Expand Down
Expand Up @@ -167,9 +167,9 @@ def _average_precision_compute_with_precision_recall(
return res[~torch.isnan(res)].mean()
weights = torch.ones_like(res) if weights is None else weights
return (res * weights)[~torch.isnan(res)].sum()
if average is None:
if average is None or average == "none":
return res
allowed_average = ("micro", "macro", "weighted", None)
allowed_average = ("micro", "macro", "weighted", "none", None)
raise ValueError(f"Expected argument `average` to be one of {allowed_average}" f" but got {average}")


Expand Down

0 comments on commit bdb3e59

Please sign in to comment.