Giter Club home page Giter Club logo

zhusuan's Introduction

ZhuSuan

build Documentation Status license

ZhuSuan is a python library for Generative Models, built upon Tensorflow. Unlike existing deep learning libraries, which are mainly designed for supervised tasks, ZhuSuan is featured for its deep root into Bayesian Inference, thus supporting various kinds of generative models: both the traditional hierarchical Bayesian models and recent deep generative models.

With ZhuSuan, users can enjoy powerful fitting and multi-GPU training of deep learning, while at the same time they can use generative models to model the complex world, exploit unlabeled data and deal with uncertainty by performing principled Bayesian inference.

Supported Inference

(Stochastic) Variational Inference (VI & SVI)

Kinds of variational posteriors we support:

  • Mean-field posterior: Fully-factorized.
  • Structured posterior: With user specified dependencies.

Variational objectives we support:

  • SGVB: Stochastic gradient variational Bayes.
  • IWAE: Importance weighted objectives.
  • NVIL: Score function estimator with variance reduction.
  • VIMCO: Multi-sample score function estimator with variance reduction.

Adaptive Importance Sampling

  • Reweighted Wake-sleep (RWS): With user specified adaptive proposal.

Markov Chain Monte Carlo (MCMC)

  • Hamiltonian Monte Carlo (HMC): Parallel chains, step size and mass adaptation.

Installation

ZhuSuan is still under development. Before the first stable release (1.0), please clone the repository and run

pip install .

in the main directory. This will install ZhuSuan and its dependencies automatically. ZhuSuan also requires Tensorflow version 1.0 or later. Because users should choose whether to install the cpu or gpu version of Tensorflow, we do not include it in the dependencies. See Installing Tensorflow.

If you are developing ZhuSuan, you may want to install in an "editable" or "develop" mode. Please refer to the Contribution section below.

Documentation

Documentation is available online: zhusuan.readthedocs.io

Examples

To run the provided examples, you may need extra dependencies to be installed. This can be done by:

pip install ".[examples]"
  • Gaussian: HMC
  • Toy 2D Intractable Posterior: SGVB
  • Bayesian Neural Networks: SGVB
  • Variational Autoencoder (VAE): SGVB, IWAE
  • Convolutional VAE: SGVB
  • Semi-supervised VAE (Kingma, 2014): SGVB, RWS
  • Deep Sigmoid Belief Networks RWS, VIMCO
  • Logistic Normal Topic Model: HMC

Contribution

To install ZhuSuan in an "editable" or "develop" mode, run

pip install -e .

in the main directory. This installation is removable by:

python setup.py develop --uninstall

Additional dependencies for developments can be installed by:

pip install ".[dev]"

Tests

This command will run automatic tests in the main directory:

python -m unittest discover -v

Test Coverage

After running tests, to ensure test coverage over the developments, run:

coverage report --include="zhusuan/*"

PEP8 Code Style Check

We follow PEP8 python code style. To check, in the main directory, run:

pep8 .

Docs

Docs are written under docs/ directory as RestructuredText (.rst) files. index.rst is the main page. A Tutorial on RestructuredText can be found here.

API References are automatically generated by Sphinx. They are under doc/api/ directory and should be regenerated each time when any code changes:

make api

To compile docs into webpages, Run

make html

under docs/ directory. The generated webpages are in docs/_build and can be viewed with browsers.

zhusuan's People

Contributors

cjf00000 avatar csy530216 avatar korepwx avatar meta-inf avatar miskcoo avatar ssydasheng avatar thjashin avatar tnlin avatar wmyw96 avatar xinmei9322 avatar

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.