Skip to content

Fix logic in how metric states referencing is handled in MetricCollection#2990

Merged
SkafteNicki merged 17 commits into
masterfrom
bugfix/collection_state_refs
Mar 13, 2025
Merged

Fix logic in how metric states referencing is handled in MetricCollection#2990
SkafteNicki merged 17 commits into
masterfrom
bugfix/collection_state_refs

Conversation

@SkafteNicki

@SkafteNicki SkafteNicki commented Mar 5, 2025

Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes #2896

Before submitting
  • Was this discussed/agreed via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?
PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃


📚 Documentation preview 📚: https://torchmetrics--2990.org.readthedocs.build/en/2990/

@SkafteNicki SkafteNicki added the bug / fix Something isn't working label Mar 5, 2025
@SkafteNicki SkafteNicki added this to the v1.6.x milestone Mar 5, 2025
@SkafteNicki SkafteNicki self-assigned this Mar 5, 2025
@Borda

Borda commented Mar 10, 2025

Copy link
Copy Markdown
Collaborator

@SkafteNicki please check:

FAILED unittests/bases/test_collections.py::TestComputeGroups::test_check_compute_groups_items_and_values[keys-metrics1-expected1-preds1-target1] - AssertionError: assert False
 +  where False = _allclose_recursive(tensor([0, 0, 0]), tensor([4, 2, 2]))
 +    where tensor([0, 0, 0]) = getattr(MulticlassAccuracy(), 'tp')
 +    and   tensor([4, 2, 2]) = getattr(MulticlassAccuracy(), 'tp')
FAILED unittests/bases/test_collections.py::TestComputeGroups::test_check_compute_groups_items_and_values[keys-metrics2-expected2-preds2-target2] - AssertionError: assert False
 +  where False = _allclose_recursive(tensor([0, 0, 0]), tensor([4, 2, 2]))
 +    where tensor([0, 0, 0]) = getattr(MulticlassRecall(), 'tp')
 +    and   tensor([4, 2, 2]) = getattr(MulticlassRecall(), 'tp')
FAILED unittests/bases/test_collections.py::TestComputeGroups::test_check_compute_groups_items_and_values[keys-metrics4-expected4-preds4-target4] - AssertionError: assert False
 +  where False = _allclose_recursive(tensor([[0, 0, 0],\n        [0, 0, 0],\n        [0, 0, 0]]), tensor([[4, 2, 6],\n        [4, 2, 8],\n        [4, 8, 2]]))
 +    where tensor([[0, 0, 0],\n        [0, 0, 0],\n        [0, 0, 0]]) = getattr(MulticlassCohenKappa(), 'confmat')
 +    and   tensor([[4, 2, 6],\n        [4, 2, 8],\n        [4, 8, 2]]) = getattr(MulticlassCohenKappa(), 'confmat')
FAILED unittests/bases/test_collections.py::TestComputeGroups::test_check_compute_groups_items_and_values[keys-metrics5-expected5-preds5-target5] - AssertionError: assert False
 +  where False = _allclose_recursive(tensor([0, 0, 0]), tensor([4, 2, 2]))
 +    where tensor([0, 0, 0]) = getattr(MulticlassAccuracy(), 'tp')
 +    and   tensor([4, 2, 2]) = getattr(MulticlassAccuracy(), 'tp')

@codecov

codecov Bot commented Mar 12, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 70%. Comparing base (0423a2c) to head (0e2e69d).
Report is 76 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #2990   +/-   ##
======================================
  Coverage      70%     70%           
======================================
  Files         352     352           
  Lines       19663   19663           
======================================
  Hits        13698   13698           
  Misses       5965    5965           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify mergify Bot added the ready label Mar 12, 2025
@SkafteNicki
SkafteNicki enabled auto-merge (squash) March 13, 2025 07:54
@mergify mergify Bot removed the has conflicts label Mar 13, 2025
@SkafteNicki
SkafteNicki merged commit cafd7cf into master Mar 13, 2025
@SkafteNicki
SkafteNicki deleted the bugfix/collection_state_refs branch March 13, 2025 10:31
Borda pushed a commit that referenced this pull request Mar 13, 2025
…ction` (#2990)

* fix logic + tests

* changelog

* fix tests

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit cafd7cf)
Borda pushed a commit that referenced this pull request Mar 13, 2025
…ction` (#2990)

* fix logic + tests

* changelog

* fix tests

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit cafd7cf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug / fix Something isn't working ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MetricCollection compute groups never re-established after copy

3 participants