v0.9.7
New Features
Distribution arg checks
Distribution arguments are now checked at run time. For example, trying to create a Bernoulli distribution with success probability of -1 will now produce the following error:
Bernoulli({p: -1});
// => Error: Parameter "p" should be of type "real [0, 1]".The docs include a list of parameters and the values they can take for each distribution.
Built-in functions
Added:
Breaking Changes
Switch to lodash
The global variable _ is now bound to lodash rather than underscore in WebPPL programs. Many of the functions available as properties of _ will continue to work as before, but there are some breaking changes. This (non-exhaustive) list of differences between the two describes many of the changes. One change it doesn't mention is that _.object is no longer available, though _.fromPairs offers the same functionality.
Global parameter set
Optimize and the Infer methods forward and SMC now implicitly operate on a global set of parameters, rather than on parameters passed via an argument.
Guide thunks
sample now expects guide distributions to be wrapped in a function of zero arguments. For example:
sample(dist, {guide: guideDist})should now be written:
sample(dist, {guide: function() { return guideDist; }});See the docs for more.
SMC ignoreGuide option
The ignoreGuide option of SMC has been replaced with a new importance option. See the docs for details of this new option.