Giter Site home page Giter Site logo

simppl's Introduction

simppl

GitHub Workflow Status

The simple (?) probabilistic programming language™

simppl is not your typical probabilistic programming language. It does not include the latest and greatest inference methods. In fact, it only has exhaustive/enumerative inference. It does not have your favorite distribution; it only includes a couple of very simplified, discretized distribution. It doesn't use that new awesome computational graph/deep learning framework, it has minimal dependencies beyond the python data stack. Because of this, models will be dead simple and inference should hopefully be fast and straightforward. Rather than a library you should use for production, it is a sandbox for quirky Bayesian inference ideas and for starting conversations around the theme of "Bayesian inference for users with deadlines" (with apologies to Django). Read the blogpost here.

Install

With pip:

pip install git+git://github.com/dimenwarper/simppl.git@master

A simppl model

A simple model illustrating that simppl flavor:

from simppl.distributions import SomeValue
from simppl.utils import capture_locals
from simppl.inference import Exhaustive

import numpy as np

def sigmoid_response(toxicity, log_concentration):
    return 1 / (1 + np.exp(toxicity * log_concentration))

log_concentration = 1
true_toxicity = 0.6
inhibitions = (sigmoid_response(true_toxicity, log_concentration) + np.random.randn(2) * 0.001).reshape(-1, 1)

def cytotoxicity_model(inibitions=inhibitions):
    toxicity = SomeValue('toxicity', between=[0, 2], around=[0, 1.5], mostly=1.3)
    inhibition = SomeValue(
        'inibition', 
        between=[0, 1], 
        mostly=sigmoid_response(toxicity, log_concentration),
        observations=inhibitions
    )
                        
    capture_locals()
    return inhibition

env = Exhaustive(cytotoxicity_model)
(env
 .executions
 .assign(toxicity=lambda df: np.round(df['toxicity'], 2))
 .groupby('toxicity')['_probability_']
 .sum()
 .plot.bar()
);

This and other examples are in the showcase.ipynb.

simppl's People

Contributors

dimenwarper avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.