Blang

Blang

Tools for Bayesian data science and probabilistic exploration

Blang is a language and software development kit for doing Bayesian analysis. Our design philosophy is centered around the day-to-day requirements of real world data science. We have also used Blang as a teaching tool, both for basic probability concepts and more advanced Bayesian modelling. Here is the one minute tour:

package demo import conifer.* import static conifer.Utils.* model Example { random RealVar shape ?: latentReal, rate ?: latentReal random SequenceAlignment observations random UnrootedTree tree ?: unrootedTree(observations.observedTreeNodes) param EvolutionaryModel evoModel ?: kimura(observations.nSites) laws { shape ~ Exponential(1.0) rate ~ Exponential(1.0) tree | shape, rate ~ NonClockTreePrior(Gamma.distribution(shape, rate)) observations | tree, evoModel ~ UnrootedTreeLikelihood(tree, evoModel) } }

The above example illustrates several aspects of Blang:

If you have one more minute to spare, let us see what happen when we run this model (if you want to try at home, all you need to run this is Open or Oracle SDK 8 SDK and git installed):

> git clone https://github.com/UBC-Stat-ML/blangExample.git [cloning] > ./gradlew installDist [downloading dependencies and compiling] > ./build/install/example/bin/example \ --model.observations.file data/primates.fasta \ --model.observations.encoding DNA \ --engine SCM \ --engine.nThreads Max \ --excludeFromOutput observations Preprocess { 4 samplers constructed with following prototypes: RealScalar sampled via: [RealSliceSampler] UnrootedTree sampled via: [SingleNNI, SingleBranchScaling] } [ endingBlock=Preprocess blockTime=194.1ms blockNErrors=0 ] Inference { [...] Log normalization constant estimate: -1216.5646966156646 Final rejuvenation started } [ endingBlock=Inference blockTime=2.763min blockNErrors=0 ] Postprocess { No post-processing requested. Use '--postProcessor DefaultPostProcessor' or run after the fact using 'postprocess --help' } [ endingBlock=Postprocess blockTime=1.446ms blockNErrors=0 ] executionMilliseconds : 166022 outputFolder : /Users/bouchard/w/blangExample/results/all/2020-09-24-22-06-26-pAotxNaQ.exec


Get started