GithubHelp home page GithubHelp logo

ameya98 / webppl Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 0.0 931 KB

Bayesian learning and inference with WebPPL.

Home Page: https://ameya98.github.io/WebPPL/generative_art/

License: MIT License

JavaScript 77.62% CSS 9.47% HTML 12.91%
d3js generative-art bayesian-inference probabilistic-programming webppl inference probabilistic-programming-language bayesian-regression

webppl's Introduction

WebPPL

WebPPL is a Probabilistic Programming Language, built over JavaScript. This repository contains gists written in WebPPL that highlight WebPPL's inference capabilities.

Inference over Stochastic L-Systems

Create generative trees guided by a stochastic L-system here! Graphics made with the help of d3.js. Performs inference with WebPPL over the number of leaves to identify the depth selected. The depth is the number of times the L-system rules are applied to the current string.

The use of WebPPL complicates the 'save' and 'restore' operations in the L-system, because all JS functions must be referentially transparent, ie, they should not alter state. This means the stack used to restore states must be implicit - see the perform_action() function if interested.

All graphics are SVG elements, so tools like svg-grabber can be used to save your favorite trees. Credit to Tipue for the nice radio button CSS!

a tree in d3

Bayesian Regression

Bayesian regression allows us to estimate parameters as well as the probability density over the parameter space, conditional on training data. See bayesian_regression.js to see how to perform Bayesian linear regression in WebPPL.
In our example, when attempting to learn y = -2x + 20, we get the following densities over the slope (m) and intercept (c) in y = mx + c respectively, showing a good fit.

slope density intercept density

The peaks near m = -2 and c = 20 are clear.

References

webppl's People

Contributors

ameya98 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.