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

MMD's y_mapping is not convenient #8095

Open
thibaultdvx opened this issue Sep 19, 2024 · 0 comments
Open

MMD's y_mapping is not convenient #8095

thibaultdvx opened this issue Sep 19, 2024 · 0 comments

Comments

@thibaultdvx
Copy link

Problem
I would like to use Maximum Mean Discrepancy metric with a kernel (e.g. gaussian kernel).

According to the reference paper, we have (eq. 3):

$${{MMD}}^2 = \frac{1}{m(m-1)} \sum_{i=1}^m \sum_{j\neq i}^m k(x_i, x_j) + \frac{1}{n(n-1)} \sum_{i=1}^n \sum_{j\neq i}^n k(y_i, y_j) - \frac{2}{mn} \sum_{i=1}^m \sum_{j=1}^n k(x_i, y_j)$$

with: $k(x,y) = <\phi(x),\phi(y)>$, $k$ being a kernel and $\phi$ a transformation.

It seems to me that in your implementation, you use the form with $\phi$ (which corresponds to y_mapping) rather than using the form with a kernel.

Suggested solution
As you mentioned in the docs, MMD is a "kernel-based method", so I would suggest to use the kernel form and replace the y_mapping argument with a kernel argument. It would be more consistent with common MMD implementations I found ([1], [2], [3] or [4]).

I would be happy to make the changes if you agree!

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