Skip to content

unify mmd #42

@smidl

Description

@smidl

Right now, mmd is scattered trough the whole code:

  1. in utils: mmd(k,X,Y)
  2. in abstract_pdfs: mmd(p::AbstractCPDF, q::AbstractPDF, z::AbstractArray, k)
  3. in vae: mmd(m::AbstractVAE, x::AbstractArray, k)

I do not see the need for all that. MMD is a distance between two samples, so the only meaningful definition is 1.

  1. is a specializaton to arbitrary pdfs. It would be fine for PDF,PDF where you would define N samples from each. However, as it is defined now, I am completely puzzled what it theoretical operation it should do. It is only a specific (programming convenience) form that is used in WAE, with not much meaning elsewhere. I propose to drop it.

  2. MMD is not a measure on VAE, the current function only calls some mmd from abstract_pdfs. Again, it has no theoretical meaning. I propose to drop it.

Instead, I would define a wasserstein loss as an alternative to elbo:
Wasser(m::AbstractVAE, x::AbstractArray, k, beta)=
mse(x, mean(model.decoder, mean(model.encoder,x))) + beta*mmd(k,rand(model.encoder,x), rand(model.prior,size(x,2)))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions