Skip to content

Commit

Permalink
Update net.py
Browse files Browse the repository at this point in the history
typically people use beta to refer to this value.
  • Loading branch information
Evanc123 committed Jul 23, 2018
1 parent 929af71 commit ef13d53
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/vae/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def decode(self, z, sigmoid=True):
else:
return h2

def get_loss_func(self, C=1.0, k=1):
def get_loss_func(self, beta=1.0, k=1):
"""Get loss function of VAE.
The loss value is equal to ELBO (Evidence Lower Bound)
multiplied by -1.
Args:
C (int): Usually this is 1.0. Can be changed to control the
beta (int): Usually this is 1.0. Can be changed to control the
second term of ELBO bound, which works as regularization.
k (int): Number of Monte Carlo samples used in encoded vector.
"""
Expand All @@ -60,7 +60,7 @@ def lf(x):
/ (k * batchsize)
self.rec_loss = rec_loss
self.loss = self.rec_loss + \
C * gaussian_kl_divergence(mu, ln_var) / batchsize
beta * gaussian_kl_divergence(mu, ln_var) / batchsize
chainer.report(
{'rec_loss': rec_loss, 'loss': self.loss}, observer=self)
return self.loss
Expand Down

0 comments on commit ef13d53

Please sign in to comment.