https://github.com/dharasim/simpleprobabilisticprograms.jl

Simple implementation of probabilistic programs for the Julia programming language

https://github.com/dharasim/simpleprobabilisticprograms.jl

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 2 committers (50.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary

Keywords

julia probabilistic-programming statistics
Last synced: 5 months ago · JSON representation

Repository

Simple implementation of probabilistic programs for the Julia programming language

Basic Info
  • Host: GitHub
  • Owner: dharasim
  • License: gpl-3.0
  • Language: Julia
  • Default Branch: master
  • Homepage:
  • Size: 70.3 KB
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 3
Topics
julia probabilistic-programming statistics
Created about 4 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

readme.md

Simple Probabilistic Programs

Simple implementation of probabilistic programs for the Julia programming language with support for traces allocated on the stack.

Status

This package is very much work in progress and it is likely to change in the future. Comments, suggestions, and pull requests are welcome!

Quickstart

```julia julia> using SimpleProbabilisticPrograms

julia> using Distributions: Beta, Bernoulli

julia> @probprog function betabernoullimodel(a, b, n) bias ~ Beta(a, b) # sample a number between 0 and 1 coin = Bernoulli(bias) # create biased coin as Bernoulli distribution throws ~ iid(coin, n) # throw the coin n times return (; bias, throws) # return the trace of the program execution end betabernoullimodel (generic function with 1 method)

julia> model = betabernoullimodel(3, 4, 10) ProbProg(...)

julia> trace = rand(model) (bias = 0.15035879436791896, throws = Bool[0, 1, 0, 0, 0, 0, 0, 0, 0, 0])

julia> logpdf(model, trace) -3.5451416292361504 ```

Introduction and Motivation

Probabilistic programming is a great way of making the power of Bayesian statistics more accessible by drawing from research in programming languages. A probabilistic program represents a distribution over the random choices that are made in a standard execution of the program. The collection of all such choices is called a trace of the probabilistic program. While probabilistic programming systems like Gen.jl and Turing.jl (also Pyro and PyMC3 in python) focus on the implementation and integration of inference methods, the motivation of this package is to provide a minimal implementation of probabilistic programs with a simple API, full compositionality, and fast performance through type stability. This can be helpful, for example, for applications that go beyond the use cases of established probabilistic programming systems, if such systems seem to be too complex for your use case, or if you want to learn/teach how probabilistic programming works. In particular, if you want to write down a distribution that is just a bit more complicated than the ones provided by Distributions.jl, this package might help you.

Implementing an extensive library of inference methods that work out of the box is not the goal of this package.

High-Level API

This package builds on the fact that all you need to get started with using probabilistic programs are 3 things: 1. a way to define them 2. a function for drawing a trace randomly, and 3. a function for evaluating the log probability of a trace.

The specification of this high-level API is: 1. Macro @probprog function_definition: Define functions that construct probabilistic programs. This macro transforms sample statements indicated by the binary operator ~ into calls to a more low-level sample method (see the source code). Call the function generated by this macro to create a probabilistic program object (see example in Quickstart above). 2. Function rand([rng,] prog): draw a random sample 3. Function logpdf(prog, x): evaluate log probability (density) of a random sample. If the return values of prog are its execution traces, then logpdf(prog, trace) works out of the box. Otherwise, the function recover_trace(prog, x) needs to be implemented.

Owner

  • Name: Daniel Harasim
  • Login: dharasim
  • Kind: user
  • Location: Lausanne, Switzerland
  • Company: EPFL

Postdoctoral Researcher at EPFL

GitHub Events

Total
Last Year

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 40
  • Total Committers: 2
  • Avg Commits per committer: 20.0
  • Development Distribution Score (DDS): 0.275
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Daniel Harasim d****m@e****h 29
Daniel Harasim d****m@g****m 11
Committer Domains (Top 20 + Academic)
epfl.ch: 1

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 0
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • dharasim (1)
Top Labels
Issue Labels
Pull Request Labels