1 Star 0 Fork 0

GhMa/variational-autoencoder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Variational Autoencoder / Deep Latent Gaussian Model in tensorflow and pytorch

Reference implementation for a variational autoencoder in TensorFlow and PyTorch.

I recommend the PyTorch version. It includes an example of a more expressive variational family, the inverse autoregressive flow.

Variational inference is used to fit the model to binarized MNIST handwritten digits images. An inference network (encoder) is used to amortize the inference and share parameters across datapoints. The likelihood is parameterized by a generative network (decoder).

Blog post: https://jaan.io/what-is-variational-autoencoder-vae-tutorial/

Example output with importance sampling for estimating the marginal likelihood on Hugo Larochelle's Binary MNIST dataset. Finaly marginal likelihood on the test set of -97.10 nats.

$ python train_variational_autoencoder_pytorch.py --variational mean-field
step:   0       train elbo: -558.69
step:   0               valid elbo: -391.84     valid log p(x): -363.25
step:   5000    train elbo: -116.09
step:   5000            valid elbo: -112.57     valid log p(x): -107.01
step:   10000   train elbo: -105.82
step:   10000           valid elbo: -108.49     valid log p(x): -102.62
step:   15000   train elbo: -106.78
step:   15000           valid elbo: -106.97     valid log p(x): -100.97
step:   20000   train elbo: -108.43
step:   20000           valid elbo: -106.23     valid log p(x): -100.04
step:   25000   train elbo: -99.68
step:   25000           valid elbo: -104.89     valid log p(x): -98.83
step:   30000   train elbo: -96.71
step:   30000           valid elbo: -104.50     valid log p(x): -98.34
step:   35000   train elbo: -98.64
step:   35000           valid elbo: -104.05     valid log p(x): -97.87
step:   40000   train elbo: -93.60
step:   40000           valid elbo: -104.10     valid log p(x): -97.68
step:   45000   train elbo: -96.45
step:   45000           valid elbo: -104.58     valid log p(x): -97.76
step:   50000   train elbo: -101.63
step:   50000           valid elbo: -104.72     valid log p(x): -97.81
step:   55000   train elbo: -106.78
step:   55000           valid elbo: -105.14     valid log p(x): -98.06
step:   60000   train elbo: -100.58
step:   60000           valid elbo: -104.13     valid log p(x): -97.30
step:   65000   train elbo: -96.19
step:   65000           valid elbo: -104.46     valid log p(x): -97.43
step:   65000           test elbo: -103.31      test log p(x): -97.10

Using a non mean-field, more expressive variational posterior approximation (inverse autoregressive flow, https://arxiv.org/abs/1606.04934), the test marginal log-likelihood improves to -95.33 nats:

$ python train_variational_autoencoder_pytorch.py --variational flow
step:   0       train elbo: -578.35
step:   0               valid elbo: -407.06     valid log p(x): -367.88
step:   10000   train elbo: -106.63
step:   10000           valid elbo: -110.12     valid log p(x): -104.00
step:   20000   train elbo: -101.51
step:   20000           valid elbo: -105.02     valid log p(x): -99.11
step:   30000   train elbo: -98.70
step:   30000           valid elbo: -103.76     valid log p(x): -97.71
step:   40000   train elbo: -104.31
step:   40000           valid elbo: -103.71     valid log p(x): -97.27
step:   50000   train elbo: -97.20
step:   50000           valid elbo: -102.97     valid log p(x): -96.60
step:   60000   train elbo: -97.50
step:   60000           valid elbo: -102.82     valid log p(x): -96.49
step:   70000   train elbo: -94.68
step:   70000           valid elbo: -102.63     valid log p(x): -96.22
step:   80000   train elbo: -92.86
step:   80000           valid elbo: -102.53     valid log p(x): -96.09
step:   90000   train elbo: -93.83
step:   90000           valid elbo: -102.33     valid log p(x): -96.00
step:   100000  train elbo: -93.91
step:   100000          valid elbo: -102.48     valid log p(x): -95.92
step:   110000  train elbo: -94.34
step:   110000          valid elbo: -102.81     valid log p(x): -96.09
step:   120000  train elbo: -88.63
step:   120000          valid elbo: -102.53     valid log p(x): -95.80
step:   130000  train elbo: -96.61
step:   130000          valid elbo: -103.56     valid log p(x): -96.26
step:   140000  train elbo: -94.92
step:   140000          valid elbo: -102.81     valid log p(x): -95.86
step:   150000  train elbo: -97.84
step:   150000          valid elbo: -103.06     valid log p(x): -95.92
step:   150000          test elbo: -101.64      test log p(x): -95.33
MIT License Copyright (c) 2016 Jaan Altosaar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Variational autoencoder implemented in tensorflow and pytorch (including inverse autoregressive flow) 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ghma/variational-autoencoder.git
git@gitee.com:ghma/variational-autoencoder.git
ghma
variational-autoencoder
variational-autoencoder
master

搜索帮助