Bayesian Linear Regression
var data = [[0, 0], [1, 1], [2, 4], [3, 6]]; window.plotData(data); var model = function() { var m = gaussian(0, 2); var b = gaussian(0, 2); var sigmaSquared = gamma(1, 1); var f = function(x) { return m * x + b; }; map( function(xy) { factor(gaussianERP.score([f(xy[0]), sigmaSquared], xy[1])); }, data); sleep(window.readSleep()); return [m, b, sigmaSquared]; }; // Available kernels: // HMCKernel // MHKernel // MCMC(model, { kernel: HMCKernel, samples: 1000, callback: samplerCallback });
Sleep per-sample:
(ms)
Implemented using
webppl
.