Giter Club home page Giter Club logo

pymc3_talk's Introduction

Bayesian Data Analysis with PyMC3

Abstract

Probabilistic Programming allows flexible specification of statistical models to gain insight from data. Estimation of best fitting parameter values, as well as uncertainty in these estimations, can be automated by sampling algorithms like Markov chain Monte Carlo (MCMC). The high interpretability and flexibility of this approach has lead to a huge paradigm shift in scientific fields ranging from Cognitive Science to Data Science and Quantitative Finance.

PyMC3 is a new Python module that features next generation sampling algorithms and an intuitive model specification syntax. The whole code base is written in pure Python and Just-in-time compiled via Theano for speed.

In this talk I will provide an intuitive introduction to Bayesian statistics and how probabilistic models can be specified and estimated using PyMC3.

Links

Presentations

There are two different talks on the same topic (EuroPython and PyData):

Dependencies

Depending on what you already installed, you may need to take the following steps:

  1. On OS X, you may need to install MacTex from http://mirror.ctan.org/systems/mac/mactex/MacTeX.pkg

  2. pip install brewer2mpl brew install git pip install git+https://github.com/olgabot/prettyplotlib.git

  3. pip install git+https://github.com/pymc-devs/pymc

  4. pip install patsy pip install statsmodels

  5. pip install zipline

pymc3_talk's People

Contributors

alexcoventry avatar twiecki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pymc3_talk's Issues

Update for newer version of PyMC3?

I was working through your Jupyter notebook here: http://nbviewer.ipython.org/github/twiecki/pymc3_talk/blob/master/bayesian_pymc3.ipynb

And when I got to input [40]:

model_randomwalk = pm.Model()
with model_randomwalk:
    # std of random walk, best sampled in log space.
    sigma_alpha, log_sigma_alpha = model_randomwalk.TransformedVar(
                            'sigma_alpha', 
                            pm.Exponential.dist(1./.02, testval = .1), 
                            pm.logtransform
    )
    sigma_beta, log_sigma_beta = model_randomwalk.TransformedVar(
                            'sigma_beta', 
                            pm.Exponential.dist(1./.02, testval = .1),
                            pm.logtransform
    )

I ran into a lot of problems. First, it appears that TransformedVar is no longer a method of pm.Model(). I substituted simply Var in both places, but then it broke on pm.logtransform, so I changed that to pm.log, but that broke with the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-42-a7745240c5a6> in <module>()
      6                             'sigma_alpha',
      7                             pm.Exponential.dist(1./.02, testval = .1),
----> 8                             pm.log
      9 #                             pm.logtransform
     10     )

/Users/jonathan/miniconda2/envs/pymc3/lib/python3.5/site-packages/pymc3/model.py in Var(self, name, dist, data)
    239                     self.named_vars[v.name] = v
    240         else:
--> 241             var = ObservedRV(name=name, data=data, distribution=dist, model=self)
    242             self.observed_RVs.append(var)
    243             if var.missing_values:

/Users/jonathan/miniconda2/envs/pymc3/lib/python3.5/site-packages/pymc3/model.py in __init__(self, type, owner, index, name, data, distribution, model)
    500 
    501         if distribution is not None:
--> 502             data = as_tensor(data, name,model,distribution.dtype)
    503             self.missing_values = data.missing_values
    504 

/Users/jonathan/miniconda2/envs/pymc3/lib/python3.5/site-packages/pymc3/model.py in as_tensor(data, name, model, dtype)
    459 
    460 def as_tensor(data, name,model, dtype):
--> 461     data = pandas_to_array(data).astype(dtype)
    462 
    463     if hasattr(data, 'mask'):

TypeError: float() argument must be a string or a number, not 'Elemwise'

I was running this code by creating a new conda environment via the following command that I ran today:

conda create -n pymc3 python=3 matplotlib pandas seaborn scikit-learn numpy scipy patsy jupyter notebook 

source activate pymc3

pip install --process-dependency-links git+https://github.com/pymc-devs/pymc3

Versions:

pymc3: 3.0

Any update to this document would greatly help!

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.