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

Question about how to select domain labels #3

Open
Freak0728 opened this issue Sep 3, 2021 · 4 comments
Open

Question about how to select domain labels #3

Freak0728 opened this issue Sep 3, 2021 · 4 comments

Comments

@Freak0728
Copy link

Hi, I am lucky to see your code, it helps me a lot, but one thing I can't understand is how to choose domain labels when calculating domain loss. I would appreciate it if you could answer this question.

@daoyuan98
Copy link
Owner

Hi, thank you for your interests in the code. The domain loss is actually calculated by a binary classification loss. Suppose there are source domains, {S1, S2, ..., Sk}, we calculate k domain losses by differentiating each source and the target domain T. For each source-target pair {Si, T}, the domain label is either 0 or 1.

@Freak0728 Freak0728 reopened this Sep 3, 2021
@Freak0728
Copy link
Author

Thank you for your reply, I saw your code address from the issue reply under MDAN code.
I don't know if you have seen the code of the article "MDAN: Multiple Source Domain Adaptation with Adversarial Learning", the code address is as follows: https://github.com/hanzhaoml/MDAN.
In its Amazon sentiment analysis experiment, when calculating the domain loss, the source label was set to all 1 and the target label was set to all 0. I just don't understand the principle of this.
The code is as follows:
domain_losses = torch.stack([F.nll_loss(sdomains[j], slabels) +
F.nll_loss(tdomains[j], tlabels) for j in range(num_domains)])

@daoyuan98
Copy link
Owner

Hi, I personally think this should not influence the results as long as the domain label is consistent across all source-target pairs, i.e. always set source=1&target=0 or source=0&target=1.

@Freak0728
Copy link
Author

Okay, thanks very much, I understand it roughly!

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

No branches or pull requests

2 participants