UnsupervisedDeepLearning-Pytorch
UnsupervisedDeepLearning-Pytorch copied to clipboard
Possible bug in the code
https://github.com/eelxpeng/UnsupervisedDeepLearning-Pytorch/blob/6ea7b7151ae62bf0130b56cc023f2be068aa87f0/udlp/clustering/vade.py#L119
Hi!
In this line, why did you replace -
(minus) with +
at the end?
Note that it is -torch.sum(first_term + second_term)
. I enclose the two terms inside the sum with a negative sign on the front. In math, it should be -log(1/2*pi*sigma^2) - (x-mu)^2/sigma^2
.
Thanks for the clarification. Didn't notice the parentheses.
Hi,
How about this? why are you adding pi?
qentropy = -0.5*torch.sum(1+z_log_var+math.log(2*math.pi), 1)
I think it is a wrong naming for logpzc variable. Better be KL divergence p_z_c and p_z_x
,and qentropy is included.
Also in the loss function, you are only considering binary cross-entropy case in the loss function.