Skip to content
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

Merged
merged 7 commits into from
Oct 24, 2024
Merged

[MRG] Add MCC method #250

merged 7 commits into from
Oct 24, 2024

Conversation

tgnassou
Copy link
Collaborator

@tgnassou tgnassou commented Oct 7, 2024

No description provided.

Copy link
Collaborator

@YanisLalou YanisLalou left a 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


# 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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
W = (1 + torch.exp(H)) / torch.mean(1 + torch.exp(H))
W = (1 + torch.exp(-H)) / torch.mean(1 + torch.exp(-H))

Copy link
Collaborator Author

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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
C_ = C_tilde - torch.diag(torch.diag(C_tilde))
C_ = C_tilde - torch.diag(C_tilde)

Copy link
Collaborator Author

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

Copy link
Collaborator

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

Copy link

codecov bot commented Oct 11, 2024

Codecov Report

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

Project coverage is 81.35%. Comparing base (e80e205) to head (44d9743).

❗ There is a different number of reports uploaded between BASE (e80e205) and HEAD (44d9743). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (e80e205) HEAD (44d9743)
2 1
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     

@rflamary rflamary changed the title [TO_REVIEW] Add MCC method [MRG] Add MCC method Oct 24, 2024
@rflamary rflamary merged commit f700f6c into scikit-adaptation:main Oct 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants