score_sde_pytorch icon indicating copy to clipboard operation
score_sde_pytorch copied to clipboard

Wrong Likelihood Computation for VE SDE

Open lujiazho opened this issue 1 year ago • 2 comments

https://github.com/yang-song/score_sde_pytorch/blob/cb1f359f4aadf0ff9a5e122fe8fffc9451fd6e44/sde_lib.py#L244

I think this line should be

-N / 2. * np.log(2 * np.pi * self.sigma_max ** 2) - torch.sum((z-x) ** 2, dim=(1, 2, 3)) / (2 * self.sigma_max ** 2)

where the x is the initial x0 which should be passed into this function

instead of

-N / 2. * np.log(2 * np.pi * self.sigma_max ** 2) - torch.sum(z ** 2, dim=(1, 2, 3)) / (2 * self.sigma_max ** 2)

isn't it?

lujiazho avatar Jul 23 '24 10:07 lujiazho

As I understand it, the prior probabilities are calculated here, and the final distribution is assumed to be a Gaussian distribution with a mean of 0, so x in (z-x) =0。 In addition, there is no x in the function parameter pass :)

daihuiao avatar Jul 24 '24 12:07 daihuiao

As I understand it, the prior probabilities are calculated here, and the final distribution is assumed to be a Gaussian distribution with a mean of 0, so x in (z-x) =0。 In addition, there is no x in the function parameter pass :)

Thanks for your reply :) To my understanding, the prior is the p(x_T) which for VE SDE is as below image where the mean is actually x0 not 0

lujiazho avatar Jul 27 '24 08:07 lujiazho