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] Fix mdd loss #277

Merged
merged 4 commits into from
Nov 17, 2024
Merged

Conversation

antoinecollas
Copy link
Collaborator

Use equations (26)-(29) from https://arxiv.org/pdf/1904.05801

@antoinedemathelin
Copy link
Contributor

It seems nice, but why adding the new arguments domain_criterion_t and domain_criterion_s? I feel it adds too much complexity. Maybe we can say that the original MDD paper only focus on multi classification, and we do the same here. We can almost remove the domain_criterion argument and hardset it to be crossentropy for source and custom crossentropy for target.
Wdyt?

We can let to future PRs the generalization of MDD to other losses?

@antoinecollas
Copy link
Collaborator Author

I agree, I change this

@antoinedemathelin
Copy link
Contributor

Ok, I just have one comment, but the rest is ok for me.

@antoinecollas antoinecollas changed the title [TO_REVIEW] Fix mdd loss [MRG] Fix mdd loss Nov 17, 2024
@antoinecollas antoinecollas merged commit 7d8ebc1 into scikit-adaptation:main Nov 17, 2024
5 checks passed
"""Compute the modified CrossEntropyLoss"""
prob = F.softmax(input, dim=-1)
prob = prob[..., target]
log_one_minus_prob = torch.log(1 - prob)
Copy link
Contributor

Choose a reason for hiding this comment

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

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