Some months ago I started to learn webbpl but after a while realized that I had to brush up my JavaScript skills so I haven't done much webppl since then.
However, today I started to test some webppl models that worked before but don't work as expected anymore. For example the following simple binomial model:
""""
var binomial = function() {
var a = sample(Bernoulli({ p: 0.5 }))
var b = sample(Bernoulli({ p: 0.5 }))
var c = sample(Bernoulli({ p: 0.5 }))
return a + b + c
}
var binomialDist = Infer({ model: binomial })
display(expectation(binomialDist))
display(binomialDist)
"""
Before it printed the following:
$ webppl binomial.wppl
"""
Marginal:
1 : 0.3750000000000001
2 : 0.3750000000000001
0 : 0.12500000000000003
3 : 0.12500000000000003
"""
However, now it displays just the dist object:
$ webppl binomial.wppl
"""
dist {
params: {
dist: { '0': [Object], '1': [Object], '2': [Object], '3': [Object] } },
supp: [ 0, 1, 2, 3 ],
getDist: [Function (anonymous)]
}
"""
Note that some functions works, such as expectation for the model above:
"""
display(expectation(binomialDist))
"""
It prints 1.5000000000000004
I'm running everything in a LInux Ubuntu 18.04 LTS machine.
* webppl version:
HEAD v0.9.15-258938e /home/hakank/.nvm/versions/node/v14.5.0/lib/node_modules
U
/webppl
* node version: v14.5.0
/home/hakank/.nvm/versions/node/v14.5.0/bin/node
As indicated, I've installed webppl with
$ npm install -g webppl
and using nvm for setting the node.js version.
When playing JavaScript I did a lot of things such as installing different versions of node.js, installed a lot of different npm modules etc, so the environment is not at all the same as when I first tested webppl. So I must have done some weird stuff...
Does anyone know how to restore a working version/environment? Have I forgot to install some packages or just done some newbie mistake in my model?
Best regards,
Hakan