GithubHelp home page GithubHelp logo

dgm.pt's Introduction

dgm.pt

Pytorch code for building deep generative models

Install https://github.com/probabll/dists.pt

Then

pip install -r requirements.txt
python setup.py develop

Register parameterization

Use decorators to register a parameterization of a distribution, e.g.

@register_conditional_parameterization(Normal)
def make_normal(inputs, event_size):
    params = torch.split(inputs, event_size, -1)
    return Normal(loc=params[0], scale=F.softplus(params[1]))

Use conditioners to parameterize components. For example, here we show the prior, approximate posterior, and likelihood of the classic MNIST VAE:

p_z = PriorLayer(
    event_shape=z_size,
    dist_type=Normal,
    params=[0., 1.]
)
q_z = ConditionalLayer(
    event_size=z_size,
    dist_type=Normal,
    conditioner=FFConditioner(
        input_size=x_size,
        output_size=z_size * 2,  # Gaussians take two parameters per unit
        hidden_sizes=[x_size // 2]
    )
)
p_x_given_z = FullyFactorizedLikelihood(
    event_size=x_size, 
    dist_type=Bernoulli, 
    conditioner=FFConditioner(
        input_size=z_size, 
        output_size=x_size * 1,   # Bernoullis take one parameter per unit
        hidden_sizes=[x_size // 2]
    )            
)

Design

  • Bijection: an invertible transformation (which also computes log det jacobian)
  • Conditioner: maps from data to D-dimensional output
  • ConditionalLayer: parameterises a certain distribution (using a conditioner)
  • LikelihoodLayer: parameterises a certain distribution (using a conditioner) and also provides a dedicated sampling procedure
  • NF: a type of distribution

dgm.pt's People

Contributors

wilkeraziz avatar eelcovdw avatar nicola-decao avatar

Stargazers

Nikolaus Schlemm avatar Shreyas Jaiswal avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

deep-spin

dgm.pt's Issues

Confusing argument names

The autoregressive likelihood uses the named argument history to refer to the observation (conditioned on autoregressively) and inputs to refer to the features conditioned on freely, which causes confusion. Follow other software packages and name the former observation.

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.