GithubHelp home page GithubHelp logo

autoconj's Introduction

This is code for the NeurIPS 2018 paper "Autoconj: Recognizing and Exploiting Conjugacy Without a Domain-Specific Language" by Matthew D Hoffman*, Matthew J Johnson*, and Dustin Tran.

Deriving conditional and marginal distributions using conjugacy relationships can be time consuming and error prone. In this project, we propose a strategy for automating such derivations. Unlike previous systems which focus on relationships between pairs of random variables, our system (which we call AutoConj) operates directly on Python functions that compute log-joint distribution functions. Autoconj provides support for conjugacy-exploiting algorithms in any Python-embedded PPL. This paves the way for accelerating development of novel inference algorithms and structure-exploiting modeling strategies.

This is not an official Google product.

autoconj's People

Contributors

matthewmackay avatar mattjj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autoconj's Issues

Python 3 compatibility

In Python 3:

  1. parens are not allowed around lambda parameters
  2. apply was removed from the language
  3. reduce was moved into functools to encourage the use of comprehensions instead

flake8 testing of https://github.com/google-research/autoconj on Python 3.7.1

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./autoconj/conjugacy.py:250:28: E999 SyntaxError: invalid syntax
  make_mean_init = (lambda (i, normalizer): lambda scale=1.:
                           ^
./autoconj/tracers.py:388:18: F821 undefined name 'apply'
  fun.fmap_out = apply
                 ^
./autoconj/tracers.py:516:10: F821 undefined name 'reduce'
  return reduce(np.add, args)
         ^
./autoconj/matchers.py:89:25: F821 undefined name 'reduce'
def _set(*elts): return reduce(operator.or_, map(_singleton, elts))
                        ^
./autoconj/matchers.py:248:51: F821 undefined name 'list_patterns'
    lambda pat: match_list(*map(make_combinators, list_patterns(pat))))
                                                  ^
./examples/mixture_of_gaussians_variational.py:123:46: F821 undefined name 'itr'
    plt.savefig('/tmp/gmm_{:04d}.png'.format(itr))
                                             ^
./examples/mixture_of_gaussians_variational_tensorflow.py:129:46: F821 undefined name 'itr'
    plt.savefig('/tmp/gmm_{:04d}.png'.format(itr))
                                             ^
1     E999 SyntaxError: invalid syntax
6     F821 undefined name 'reduce'
7

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. These 5 are different from most other flake8 issues which are merely "style violations" -- useful for readability but they do not effect runtime safety.

  • F821: undefined name name
  • F822: undefined name name in __all__
  • F823: local variable name referenced before assignment
  • E901: SyntaxError or IndentationError
  • E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

ImportError: cannot import name 'toposort'

Hey guys,

Very nice work!

It seems some of the functions are missing. Here is an example:

     44 from autograd.tracer import Node
---> 45 from autograd.util import toposort
     46 from autograd.util import subvals
     47 from autograd import core

ImportError: cannot import name 'toposort'

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.