observeData({data: data, link: Dist, display: true/false})
: e.g.,observeData({data: [1,2], link: Binomial({n:2, p:0.5}), display: true})
(display will print out the score to the console). Shorthand forfactor(Dist.score(data))
(but works with arrays as well as singleton data points)foreach(array, function)
: likemap
, but no return (useful for IncrementalMH)marginalize(Dist, label)
: go from a joint distribution to a marginal distribution
DiscreteGaussian({mu: ..., sigma: ..., lower: ..., upper: ..., binWidth: ...})
: a discretized Gaussian disribution with lower and upper bound stipulated [default lower and upper set to 1 and 7]OrdinalGaussian({mu: ..., sigma: ..., thresholds: ...})
: an ordinalized Gaussian distribution (e.g., for ordinal regression). e.g.OrdinalGaussian({mu: 1, sigma:2.5, thresholds: [1.5, 2.5, 3.5, 4.5, 5.5, 6.5]})
gaussianCDF({mu: ..., sigma: ..., x: ...})
: e.g.gaussianCDF({mu: 3.5, sigma:1, x: 2})
exp(x)
: exponentiation e.g.exp(1.37)
probability(x, Dist)
: shorthand forexp(Dist.score(x))
Accessed via bdaUtils.function
, e.g. bdaUtils.isNumeric(x)
isNumeric(x)
where x may or may not be numericparseFloat(x)
where x is a stringfillArray(x, length)
erf(x)
where x is numericclosest(x, array)
: find the closest value to x in array of numbers
You can install this pacakge using:
npm install --prefix ~/.webppl mhtess/webppl-bda