-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRG] Add MCC method #250
[MRG] Add MCC method #250
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 small suggested changes - otherwise looks good to me
skada/deep/losses.py
Outdated
|
||
# Uncertainty Reweighting & class correlation matrix | ||
H = -torch.sum(y_scaled * torch.log(y_scaled), axis=1) | ||
W = (1 + torch.exp(H)) / torch.mean(1 + torch.exp(H)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W = (1 + torch.exp(H)) / torch.mean(1 + torch.exp(H)) | |
W = (1 + torch.exp(-H)) / torch.mean(1 + torch.exp(-H)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
C_tilde = C / torch.sum(C, axis=1, keepdim=True) | ||
|
||
# MCC Loss | ||
C_ = C_tilde - torch.diag(torch.diag(C_tilde)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C_ = C_tilde - torch.diag(torch.diag(C_tilde)) | |
C_ = C_tilde - torch.diag(C_tilde) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I want is to remove the diag. If I do only one torch.diag I will have a vector and then remove the diag on all the line. Two torch.diag create a diagonal matrix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad I thought it returned a diagonal matrix directly
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #250 +/- ##
===========================================
- Coverage 97.33% 81.35% -15.98%
===========================================
Files 56 48 -8
Lines 5845 5373 -472
===========================================
- Hits 5689 4371 -1318
- Misses 156 1002 +846 |
No description provided.