import mir.math.common: approxEqual, log; assert(true.bernoulliLPMF(0.5).approxEqual(log(bernoulliPMF(true, 0.5)))); assert(false.bernoulliLPMF(0.5).approxEqual(log(bernoulliPMF(false, 0.5)))); assert(true.bernoulliLPMF(0.7).approxEqual(log(bernoulliPMF(true, 0.7)))); assert(false.bernoulliLPMF(0.7).approxEqual(log(bernoulliPMF(false, 0.7))));
Computes the bernoulli log probability mass function (LPMF).