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 the code of the unbiased estimate of MMD/JMMD #34

Open
tytcc opened this issue Mar 8, 2021 · 0 comments
Open

Question about the code of the unbiased estimate of MMD/JMMD #34

tytcc opened this issue Mar 8, 2021 · 0 comments

Comments

@tytcc
Copy link

tytcc commented Mar 8, 2021

Hi,
Thanks for your great jobs!
But I have some questions about the MMD/JMMD loss.
the unbiased estimate of JMMD in paper is as follow:
image
while the code is:

# Linear version
loss = 0
for i in range(batch_size):
    s1, s2 = i, (i+1)%batch_size
    t1, t2 = s1+batch_size, s2+batch_size
    loss += kernels[s1, s2] + kernels[t1, t2]
    loss -= kernels[s1, t2] + kernels[s2, t1]
return loss / float(batch_size)

It seems the samples are not matched. For example, there is a need for n/2 sample pairs to calculate the loss in the first term of the equation. But it uses n sample pairs in the code to calculate. why are they different?

Looking forward to your reply.

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

1 participant