Recipes icon indicating copy to clipboard operation
Recipes copied to clipboard

Variational Autoencoder: cannot understand why there is a '2' coefficient for log sigma

Open stablum opened this issue 8 years ago • 3 comments

Hi,

this is the line 190 of variational_autoencoder.py:

- 0.5 * T.sqr(tgt - mu) / T.exp(2 * ls))

where does that 2 coefficient for the log sigma come from? I did the derivations myself and I could not find it. This other implementation: https://github.com/y0ast/Variational-Autoencoder/blob/master/VAE.py does not include that multiplier. Any explanation? Is it a bug?

stablum avatar Nov 22 '16 16:11 stablum

@tencia, do you still know what you did there?

f0k avatar Nov 23 '16 17:11 f0k

No, unfortunately I don't remember where that term came from, sorry.

tencia avatar Nov 23 '16 18:11 tencia

Likely it's the square in sigma^2 ;) when dealing with log_sigma it "comes down", i.e. exp(2*log(sigma)) = exp(log(sigma^2)) = sigma^2

loek-tonnaer avatar Jul 31 '17 14:07 loek-tonnaer