阅读453 返回首页    go 京东网上商城


没有任何公式——直观的理解变分自动编码器VAE

首发地址:https://yq.aliyun.com/articles/68410


作者介绍

12b5c884dbe35a3c41dda6d19ab83b10e7801298

出来。通过简单的测量重构误差和反传网络参数能够很好的训练该类网络。

 0324a99f1be1f83b526cfc9852f6850c6a2aeefb

上图是变分自动编码器-VAE”,不同点在于其隐藏代码来自于训练期间学习到的概率分布。

90更有效的学习参数。

概率解释通过假设每个参数的概率分布来降低w_i=0.7,在概率版本中,计算均值大约为u_i = 0.7和方差为v_i = 0.1的高斯分布,即w_i =N(0.7,0.1)。这个假设将输入,隐藏表示以及神经网络的输出转换为概率随机变量。这类网络被称为贝叶斯神经网络或BNN。

d4fb842f611d24a0c42ff9fc7cb3e9686ba46dd1

,将该计算问题转换为优化问题,可以使用随机梯度下降法解决。

在贝叶斯网络中,网络可以基于分布参数重新参数化。在变分自动编码器中,仅在隐藏节点上假设这些分布。因此,编码器变成一个变分推理网络,而且译码器变成一个将隐藏代码映射回数据分布的生成网络。

81cc9fd8bcaa8074b13fedc6c43f660947652db4

将分布的均值和方差视为传统网络的参数,并将方差乘以来自噪声发生器的样本以增加随机性。通过参数化隐藏分布,可以反向传播梯度到编码器的参数,并用随机梯度下降训练整个网络。此过程能够学习重新调参技巧

在经典版的神经网络中,可以用均方误差

VAE

network= {

  # encoder
  encoder_x = Input_layer(size=input_size, input=data)
  encoder_h = Dense_layer(size=hidden_size, input= encoder_x)

  # the re-parameterized distributions that are inferred from data 
  z_mean = Dense(size=number_of_distributions, input=encoder_h)
  z_variance = Dense(size=number_of_distributions, input=encoder_h)
  epsilon= random(size=number_of_distributions)

  # decoder network needs a sample from the code distribution
  z_sample= z_mean + exp(z_variance / 2) * epsilon

  #decoder
  decoder_h = Dense_layer(size=hidden_size, input=z_sample)
  decoder_output = Dense_layer(size=input_size, input=decoder_h)
}

cost={
  reconstruction_loss = input_size * crossentropy(data, decoder_output)
  kl_loss = - 0.5 * sum(1 + z_variance - square(z_mean) - exp(z_variance))
  cost_total= reconstruction_loss + kl_loss
}

stochastic_gradient_descent(data, network, cost_total)

keras

eb74970c96711308d7b9b4fb88d0e141765aed8b

44447deb8a959a610889cb929a385efe09493614

本文由北邮@爱可可-爱生活 老师推荐,

,译者:海棠

最后更新:2017-07-12 22:09:51

  上一篇:go  深度学习网络大杀器之Dropout——深入解析Dropout
  下一篇:go  深度学习零基础?没关系——面向艺术家的RNN教程