probmods / chapters

The online textbook Probabilistic Models of Cognition
https://probmods.org
163 stars 27 forks source link

Live-update histograms for query results #19

Open ngoodman opened 10 years ago

ngoodman commented 10 years ago

Have a flag to or variant of mh-query and rejection-query that makes a histogram of samples and updates it on each sample. This can be done by extending probabilistic-js inference routines to take a listener function (which is called when a sample is taken), and then creating a listener that calls the _hist vizualization tool.

ngoodman commented 10 years ago

I think a better solution is to have hist and other viz routines (optionally) take a thunk (instead of a list of data points). This thunk is a data stream, so this hist routine repeatedly asks for the next data point and updates the histogram, until some special 'nomoredata' object is returned.

This will interface nicely with the switch from diverse query forms to a unified conditional formthat returns a thunk (that samples from the conditional distribution).

longouyang commented 10 years ago

Writing down our discussion today: the new conditional semantics might have performance issues, but it's an empirical question

longouyang commented 10 years ago

Also, re new conditional semantics: proposals for new versions of Javascript (ECMAscript 6) include support for iterators/generators.