Probabilistic programming in Scala
Odds is a small domain-specific language (DSL) for probabilistic programming, embedded in Scala. Odds provides first-class support for random variables and probabilistic choice, within Scala's powerful type system. Odds programs are actually Scala programs, which means that all of Scala's abstraction and modularity facilities can be used to compose probabilistic computations and to specify deterministic program parts.
Odds is written in Scala, which runs on the JVM. So for starters, you'll need an up-to-date JRE/JDK. If you're on a Debian/Ubuntu system, this should do the trick:
$ sudo apt-get install openjdk-7-jre
Install the SBT build tool.
Clone the GitHub repository:
$ git clone https://github.com/sstucki/odds.git
Go into the root directory and compile the source code using SBT:
$ cd odds $ sbt compile
sbt testto run the test suite.
sbt publish-localto install the Odds library for use in other projects.
Have a look at the various test cases in the
Many of them are Odds example programs, illustrating how to write an
Odds program and perform inference on it.
To build the API docs, run
sbt doc. You can find the generated API
docs in the
Our Scala'13 paper also contains an introduction to Odds and describes the principles it is built on. The source code of Odds has changed quite a bit since Scala'13, but the original source code (on which the paper was based) is available here.
Visit Odds on GitHub.