Giter Site home page Giter Site logo

Comments (4)

fsaad avatar fsaad commented on June 15, 2024

Progress in https://github.com/probcomp/sum-product-dsl/compare/20200417-fsaad-render-imp

from sppl.

fsaad avatar fsaad commented on June 15, 2024

#wont-fix

from sppl.

fsaad avatar fsaad commented on June 15, 2024

Reopening---in the past I was trying render a Command from the Python AST (interpreter.py) to an SPML program, which turns out to be rather hard.

However, what I really meant to render is an SPN into SPML program, which is much easier.

The main issue is that we need to expose the branching variables while still ensuring SPN consistency (children of sum nodes have identical scope). But this situation can be an issue since different components of a sum may not have the same branching topology, and so latent variables that "exist" in one branch may not exist in another branch, for example:

image

The blue letter "b" indicates each location where a new branching variable is introduced in the scope. It is now obvious that the SPN is not consistent, since the left-subtree has variables b2, b3 that do not exist in the right subtree.

One solution is to define give all branching variables unique and define them at the top of the program. Not so bad. The resulting SPN is:

image

which now easy to render in SPML:

b1 ~ ...
b2 ~ ...
b3 ~ ...
if (b1 == 1):
    if (b2 == 2):
        x
    else
        x '
    if (b3 == 1):
        y
    else
        y '
else:
    x
    y

It may be a bit confusing that we sample branch variables for all sum nodes, even though they are effectively unused in program executions. In the example above, if we go down the right subtree, it's a bit strange to have sampled (b2, b3), but there is no harm in doing so other than a bit of confusion, and more verbose queries for constraining a path---i.e., to constrain the SPN for b2 == 1, we need to in practice constrain the whole path (b1==0 and b2==1).

from sppl.

fsaad avatar fsaad commented on June 15, 2024
  • render conditioned reals
  • render environments for reals

from sppl.

Related Issues (20)

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.