probmods / webppl

Probabilistic programming for the web
http://webppl.org
Other
615 stars 89 forks source link

Streams (FRP) library #77

Open ngoodman opened 9 years ago

ngoodman commented 9 years ago

We should implement streams in WebPPL. More generally, the functional reactive programming model would be pretty natural and useful to adopt. If our data were a stream we could do something like data.map(function(d){factor(obs()==d)}) that would extend the execution when data comes in (in this case hitting a new factor). Presumably the return value of marginalization would then be a stream of marginal ERPs.

This would be useful in real-world interaction (see #74) as well as for smart webpages. This would also make various incremental inference models more natural. For instance, incremental parsing would amount to a streaming parse that takes a word stream in.

Use cases:

With streams in place, it should be straightforward to write glue to tie WebPPL to various event- and stream-driven frameworks such as react.js, RxJS, d3.js. This would make it much more natural to use WebPPL embedded in various applications.

ngoodman commented 9 years ago

Streams may also be a natural setting for amortized inference: learning to update faster / better on new events.

stuhlmueller commented 9 years ago

Idle vs stream-update: since streams might never end, what should WebPPL do with its "idle time" while waiting for more events?

Another possibility is speculative execution: Use the predictive distribution over the next data point to compute what would happen if you updated on some possible value, so that we can update very quickly when the data point actually comes in.

iffsid commented 9 years ago

This seems useful: http://highlandjs.org/