Commit 26d6dee
Add EmbeddingCollapseMetric: detect representational collapse in medi… (#8815)
…cal imaging embeddings
Closes #8808
Fixes # .
### Description
A few sentences describing the changes proposed in this pull request.
Adds EmbeddingCollapseMetric for detecting representational collapse in
embedding spaces — when class centroids converge, effective
dimensionality drops, or domains become indistinguishable, even while
AUROC/Dice look fine.
Computes five indicators (all [0, 1], higher = more collapsed):
centroid_similarity — L2-normalised class centroid cosine similarity
effective_rank_score — SVD effective rank (Roy & Vetterli, 2007)
per_class_rank_<cls> — per-class effective rank (asymmetric collapse)
domain_shift — linear CKA between domains (Kornblith et al., 2019)
separation — silhouette inter-class separation (sklearn optional)
Follows FIDMetric/MMDMetric pattern: inherits Metric,
tensor-in/tensor-out, torch-only core. Validated on pathology embeddings
### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] Non-breaking change (fix or new feature that would not break
existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing
functionality to change).
- [x] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u
--net --coverage`.
- [x] Quick tests passed locally by running `./runtests.sh --quick
--unittests --disttests`.
- [x] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.
Signed-off-by: ekansh-arora0 <ekansh.arora0@gmail.com>
Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>1 parent 7f6b7e5 commit 26d6dee
4 files changed
Lines changed: 904 additions & 0 deletions
File tree
- docs/source
- monai/metrics
- tests/metrics
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
161 | 168 | | |
162 | 169 | | |
163 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
0 commit comments