Git Product home page Git Product logo

hmc-vae's Introduction

HMC-VAE

This repository contains code for hierarchical convolutional variational autoencoders with Hamiltonian Monte Carlo, which accompanies my MPhil thesis at University of Cambridge.

Directory Structure

The reposiroty contains 7 Python files:

models/hmc.py      # Basic version of Hamiltonian Monte Carlo
models/blocks.py   # Conv/ConvTranspose building blocks for the model
models/vae.py      # VAE with hierarchical latent variables
models/hmc_vae.py  # VAE with hierarchical latent variables and HMC
image_dataset.py   # Download and preprocess image datasets
utils.py           # Utility for turning on/off parts of a model
train.py           # Main entry point for traning

And my thesis thesis.pdf that details theoretical background, implementation details, and experimental results.

Example

The command below trains a model with 2 latent layers each containing 30 units, and 64 filters, on the dataset CIFAR10 (which is stored in ./data), for 100 epochs (100 variational epochs and hard-coded 3 HMC epochs), with the test set evaluated after every 1 epoch, where both trained model and test set scores are written to /path/to/save/.

python3 train.py --data_name CIFAR10 --data_root ./data \
    --hidden_channels 64 --epochs 100 --eval_interval 1 \
    --savedir /path/to/save/ --latent_dims 30 30

Architecture Visualization (1 latent layer)

Encoder

encoder

Decoder

decoder

Citation

@Misc{HMC-VAE,
    author = {Haoran Peng},
    title = {Outlier Detection with Hierarchical VAEs and Hamiltonian Monte Carlo},
    year = {2022},
    url = "https://github.com/GavinPHR/HMC-VAE"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.