Soss

Probabilistic programming via source rewriting

https://github.com/cscherrer/soss.jl

Science Score: 41.0%

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

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

Keywords

bayesian-inference bayesian-statistics julia julia-language julia-library metaprogramming probabilistic-programming

Keywords from Contributors

pdes numerical probabilistic-graphical-models julialang mcmc hmc hamiltonian-monte-carlo bayesian-neural-networks probabilistic-inference probabilistic-models
Last synced: 4 months ago · JSON representation ·

Repository

Probabilistic programming via source rewriting

Basic Info
Statistics
  • Stars: 420
  • Watchers: 19
  • Forks: 30
  • Open Issues: 112
  • Releases: 48
Topics
bayesian-inference bayesian-statistics julia julia-language julia-library metaprogramming probabilistic-programming
Created about 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme Funding License Citation

README.md

Soss

Stable Dev Build Status Coverage

Soss is a library for probabilistic programming.

Let's look at an example. First we'll load things:

julia using MeasureTheory using Soss

MeasureTheory.jl is designed specifically with PPLs like Soss in mind, though you can also use Distributions.jl.

Now for a model. Here's a linear regression:

julia m = @model x begin α ~ Lebesgue(ℝ) β ~ Normal() σ ~ Exponential() y ~ For(x) do xj Normal(α + β * xj, σ) end return y end

Next we'll generate some fake data to work with. For x-values, let's use

julia x = randn(20)

Now loosely speaking, Lebesgue(ℝ) is uniform over the real numbers, so we can't really sample from it. Instead, let's transform the model and make α an argument:

julia julia> predα = predictive(m, :α) @model (x, α) begin σ ~ Exponential() β ~ Normal() y ~ For(x) do xj Normal(α + β * xj, σ) end return y end

Now we can do julia julia> y = rand(predα(x=x,α=10.0)) 20-element Vector{Float64}: 10.554133456468438 9.378065258831002 12.873667041657287 8.940799408080496 10.737189595204965 9.500536439014208 11.327606120726893 10.899892855024445 10.18488773139243 10.386969795947177 10.382195272387214 8.358407507910297 10.727173015711768 10.452311211064654 11.076232496702387 11.362009520020141 9.539433052406448 10.61851691333643 11.586170856832645 9.197496058151618

Now for inference! Let's use DynamicHMC, which we have wrapped in SampleChainsDynamicHMC.

```julia julia> using SampleChainsDynamicHMC [ Info: Precompiling SampleChainsDynamicHMC [6d9fd711-e8b2-4778-9c70-c1dfb499d4c4]

julia> post = sample(m(x=x) | (y=y,), dynamichmc()) 4000-element MultiChain with 4 chains and schema (σ = Float64, β = Float64, α = Float64) (σ = 1.0±0.15, β = 0.503±0.26, α = 10.2±0.25) ```

How is Soss different from Turing?

First, a fine point: When people say "the Turing PPL" they usually mean what's technically called "DynamicPPL".

  • In Soss, models are first class, and can be composed or nested. For example, you can define a model and later nest it inside another model, and inference will handle both together. DynamicPPL can also handle nested models (see this PR) though I'm not aware of a way to combine independently-defined DynamicPPL models for a single inference pass.
  • Soss has been updated to use MeasureTheory.jl, though everything from Distributions.jl is still available.
  • Soss allows model transformations. This can be used, for example, to easily express predictive distributions or Markov blanket as a new model.
  • Most of the focus of Soss is at the syntactic level; inference works in terms of "primitives" that transform the model's abstract syntax tree (AST) to new code. This adds the same benefits as using Julia's macros and generated functions, as opposed to higher-order functions alone.
  • Soss can evaluate log-densities symbolically, which can then be used to produce optimized evaluations for much faster inference. This capability is in relatively early stages, and will be made more robust in our ongoing development.
  • The Soss team is much smaller than that of DynamicPPL. But I hope that will change (contributors welcome!)

Soss and DynamicPPL are both maturing and becoming more complete, so the above will change over time. It's also worth noting that we (the Turing team and I) hope to move toward a natural way of using these systems together to arrive at the best of both.

How can I get involved?

I'm glad you asked! Lots of things:

For more details, please see the documentation.

Stargazers over time

Stargazers over time

Owner

  • Name: Chad Scherrer
  • Login: cscherrer
  • Kind: user
  • Location: Seattle, WA
  • Company: Redpoll

Probabilistic programming in Rust and Julia

Citation (CITATION.bib)

@misc{Soss.jl,
	author  = {Chad Scherrer},
	title   = {{Soss.jl}},
	url     = {https://github.com/cscherrer/Soss.jl},
	year    = {2019},
	month   = {9}
}

GitHub Events

Total
  • Watch event: 4
Last Year
  • Watch event: 4

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 1,013
  • Total Committers: 19
  • Avg Commits per committer: 53.316
  • Development Distribution Score (DDS): 0.105
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Chad Scherrer c****r@g****m 907
Joey Miller a****0@g****m 29
github-actions[bot] 4****] 26
Joseph j****5@a****m 12
Seth Axen s****n@g****m 9
Dilum Aluthge d****m@a****m 8
Taine Zhao t****e@o****m 6
mohamed82008 m****8@g****m 3
David Widmann d****n 2
catethos c****s@y****m 2
Fredrik Bagge Carlson b****n@g****m 1
Julia TagBot 5****t 1
Moritz Schauer m****r@w****e 1
Thibaut Lienart l****b@m****m 1
Vassily Trubetskoy 3****a 1
jfb-h 6****h 1
vargonis v****s@g****m 1
$(ci_cfg.username) $****) 1
willtebbutt w****1@m****k 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 21
  • Total pull requests: 85
  • Average time to close issues: 7 days
  • Average time to close pull requests: about 1 month
  • Total issue authors: 15
  • Total pull request authors: 4
  • Average comments per issue: 5.71
  • Average comments per pull request: 0.73
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 70
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 3
Top Authors
Issue Authors
  • sethaxen (3)
  • marius311 (2)
  • paschermayr (2)
  • jariji (2)
  • FalkoSp (2)
  • jtrakk (1)
  • cscherrer (1)
  • aelmokadem (1)
  • gzagatti (1)
  • AxLamelas (1)
  • SebastianCallh (1)
  • ParadaCarleton (1)
  • JuliaTagBot (1)
  • Tuebel (1)
  • cwoode (1)
Pull Request Authors
  • github-actions[bot] (73)
  • cscherrer (12)
  • thautwarm (2)
  • sethaxen (1)
Top Labels
Issue Labels
bug (1) enhancement (1)
Pull Request Labels
needs version bump (70)

Packages

  • Total packages: 1
  • Total downloads:
    • julia 3 total
  • Total dependent packages: 3
  • Total dependent repositories: 0
  • Total versions: 48
juliahub.com: Soss

Probabilistic programming via source rewriting

  • Versions: 48
  • Dependent Packages: 3
  • Dependent Repositories: 0
  • Downloads: 3 Total
Rankings
Stargazers count: 1.5%
Forks count: 4.6%
Average: 7.3%
Dependent repos count: 9.9%
Dependent packages count: 13.2%
Last synced: 4 months ago

Dependencies

.github/workflows/TagBot.yml actions
  • JuliaRegistries/TagBot v1 composite
.github/workflows/VersionVigilante.yml actions
  • actions/checkout v1.0.0 composite
  • actions/github-script 0.3.0 composite
  • julia-actions/setup-julia latest composite
.github/workflows/ci.yml actions
  • actions/cache v1 composite
  • actions/checkout v2 composite
  • codecov/codecov-action v1 composite
  • julia-actions/julia-buildpkg latest composite
  • julia-actions/julia-processcoverage v1 composite
  • julia-actions/julia-runtest latest composite
  • julia-actions/setup-julia v1 composite