This repository was archived by the owner on Nov 1, 2026. It is now read-only.
Repository navigation
The MMDloss generates negative outputs #103
|
I initialized the MMDLoss class and used it to process my data. Here is the code: I expected the MMD loss to output a positive value, but some outputs are negative during training. Could you help me understand why this might be happening? the blue one is the training loss, it became negative during the training. |
Answered by
KevinMusgrave
Nov 15, 2024
Replies: 1 comment 1 reply
|
I can't remember why, but here's an explanation from the official implementation of MMD: "The value of the mmd loss could be negative since we used the linear-time unbiased estimate of the mmd, which lends us an O(n) time cost but may cause negative mmd values for some mini-batch. This negative mmd value however will not influence the final classification performance." |
1 reply
Answer selected by
lyfeng001
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

I can't remember why, but here's an explanation from the official implementation of MMD:
"The value of the mmd loss could be negative since we used the linear-time unbiased estimate of the mmd, which lends us an O(n) time cost but may cause negative mmd values for some mini-batch. This negative mmd value however will not influence the final classification performance."
Link: https://github.com/thuml/DAN/blob/master/README.md