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 Java 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 Preprocessing started 4 samplers constructed with following prototypes: RealScalar sampled via: [RealSliceSampler] UnrootedTree sampled via: [SingleNNI, SingleBranchScaling] Sampling started [sampling progress report] Normalization constant estimate: -1216.1211229417504 Final rejuvenation started Preprocessing time: 141.4 ms Sampling time: 2.304 min executionMilliseconds : 138405 outputFolder : /Users/bouchard/blangExample/results/all/2017-12-15-14-00-21-3aKAx62h.exec


Get started