Comments (4)
Progress in https://github.com/probcomp/sum-product-dsl/compare/20200417-fsaad-render-imp
from sppl.
#wont-fix
from sppl.
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:
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:
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.
- render conditioned reals
- render environments for reals
from sppl.
Related Issues (20)
- Make graphviz optional HOT 1
- Expunge x >> dict notation; prefer instead x >> choice(dict).
- Change interface of logpdf to take a Python dict not Event
- Support SPPL functions with exogenous parameters for modeling GLMs
- Remove frechet_r and frechet_l which are deprecated in some scipy versions
- install numpy==1.16.6 causing weird issues through pip HOT 4
- .constrain without Identity silently fails for ProductSPN
- Implement command line interface?
- Add size() for spe HOT 1
- Memory error for big discrete Bayesian networks HOT 7
- Strange scale parameters to Normal in the fairness-income-model HOT 2
- Rename get_symbols to scope and add to SPE API
- Implement logpdf__ for AtomicLeaf
- Fix typo in spe.memoize event_factor_to_event -> event_factor
- `scipy == 1.4.1` fails to build on `osx` HOT 1
- Fix equality checking for instances of `rv_discrete`
- Fix relying on `.name` attribute of `rv_discrete`
- Possibility of using locked semantic versioned dependencies? HOT 1
- SPPL compiler replaces `==` and `in` with `<<` incorrectly at times
- Question/feature-request: combining model source code with pre-existing SPE-models HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sppl.