Questions tagged [pymc]

PyMc is a Python module for providing Bayesian statistical models, algorithms and estimations. Two versions are currently widely used: 2 and 3, that are significantly different. Version 2 is not supported anymore, but version 3 is not fully compatible with previous codes and translating a V2-code to V3 is not always straightforward. If you have a PyMc question specific to V3, consider using the [pymc3] tag in addition to the [pymc] tag.

Pymc is a Python module for providing Bayesian statistical models and algorithms. It requires Numpy. PyMC includes methods for summarizing output, plotting, goodness-of-fit and convergence diagnostics.

According to its documentation, Pymc's notable features include:

  • Bayesian statistical models with Markov chain Monte Carlo and other algorithms.
  • A suite of statistical distributions.
  • A module for modeling Gaussian processes.
  • Creates summaries including tables and plots.
  • Extensible

Source: https://github.com/pymc-devs/pymc
Pypi: https://pypi.python.org/pypi/pymc
Docs: http://pymc-devs.github.io/pymc/

511 questions
7
votes
1 answer

Probit regression using PyMC 3

I have posted an python notebook here: http://nbviewer.ipython.org/gist/awellis/9067358 I am trying create a probit regression model using PyMC 3, using generated data to recover the known parameters (see notebook). The estimate for the intercept is…
Andrew Ellis
  • 71
  • 1
  • 6
7
votes
2 answers

Solving inverse problems with PyMC

Suppose we're given a prior on X (e.g. X ~ Gaussian) and a forward operator y = f(x). Suppose further we have observed y by means of an experiment and that this experiment can be repeated indefinitely. The output Y is assumed to be Gaussian (Y ~…
juliohm
  • 3,691
  • 2
  • 18
  • 22
6
votes
0 answers

PyMC: multiple time series observations (adaptation of text message example from "Bayesian Methods for Hackers")

I'm trying to adapt the text message example from Cameron Davidson-Pilon's Bayesian Methods for Hackers, Chapter 1, "Introducing our first hammer: PyMC" to handle multiple observations. The solution below appears to be working, but I'm new to pymc…
ToddP
  • 652
  • 13
  • 18
6
votes
0 answers

How to use pymc to parameterize a probabilistic graphical model?

How can one use pymc to parameterize a probabilistic graphical model? Suppose I have a PGM with two nodes X and Y. Lets say X->Y is the graph. And X takes two values {0,1}, and Y also takes two values {0,1}. I want to use pymc to learn the…
6
votes
1 answer

Modified BPMF in PyMC3 using `LKJCorr` priors: PositiveDefiniteError using `NUTS`

I previously implemented the original Bayesian Probabilistic Matrix Factorization (BPMF) model in pymc3. See my previous question for reference, data source, and problem setup. Per the answer to that question from @twiecki, I've implemented a…
Mack
  • 2,614
  • 2
  • 21
  • 33
6
votes
1 answer

Bayesian Probabilistic Matrix Factorization (BPMF) with PyMC3: PositiveDefiniteError using `NUTS`

I've implemented the Bayesian Probabilistic Matrix Factorization algorithm using pymc3 in Python. I also implemented it's precursor, Probabilistic Matrix Factorization (PMF). See my previous question for a reference to the data used here. I'm having…
Mack
  • 2,614
  • 2
  • 21
  • 33
6
votes
2 answers

how to sample multiple chains in PyMC3

I'm trying to sample multiple chains in PyMC3. In PyMC2 I would do something like this: for i in range(N): model.sample(iter=iter, burn=burn, thin = thin) How should I do the same thing in PyMC3? I saw there is a 'njobs' argument in the…
Amir Dezfouli
  • 199
  • 3
  • 10
6
votes
1 answer

Survival analysis in PyMC 3

I tried to port simple survival model from here (the first one in introduction) form PyMC 2 to PyMC 3. However, I didn't find any equivalent to "observed" decorator and my attempt to write a new distribution failed. Could someone provide an example…
Marigold
  • 1,619
  • 1
  • 15
  • 17
6
votes
1 answer

Difficulties on pymc3 vs. pymc2 when discrete variables are involved

I'm updating some calculations where I used pymc2 to pymc3 and I'm having some problems with samplers behavior when I have some discrete random variables on my model. As an example, consider the following model using pymc2: import pymc as pm N =…
Rafael S. Calsaverini
  • 13,582
  • 19
  • 75
  • 132
5
votes
1 answer

How to do simple survival analysis with pymc3 (Weibull distribution regression)?

I'm new to using pymc3, I've read Bayesian Methods for Hackers and done my best to work through existing survival analysis tutorials in pymc3. However, I don't understand how to write/interpret the "survival function". For this problem, I've…
Noah
  • 51
  • 1
5
votes
0 answers

Incremental Bayesian updates with multi-dimensional parameters

I am trying to use PYMC3 for a Bayesian model where I would like to repeatedly train my model on new unseen data. I am thinking I would need to update the priors with the posterior of the previously trained model every time I see the data, similar…
SinByCos
  • 613
  • 1
  • 10
  • 22
5
votes
1 answer

Blackbox likelihood example

I'm trying to understand how to use a black box likelihood function in pymc. Basically, this is explained here. I have tried implementing this on my own with a very simple Python model (a double logistic function), and no gradient. In addition to…
Jose
  • 2,089
  • 2
  • 23
  • 29
5
votes
1 answer

Solving ODEs in PYMC3

Here I aim to estimate the parameters (gama and omega) of a damped harmonic oscillator given by dX^2/dt^2+gamma*dX/dt+(2*pi*omega)^2*X=0. (We can add white gaussian noise to the system.) import pymc import numpy as np import scipy.io as…
5
votes
1 answer

Posterior probability with pymc

(This question was originally posted on stats.O. I moved it here because it does relate with pymc and more general matters within it: in fact the main aim is to have a better understanding of how pymc works. If any of the moderators believe it not…
rafforaffo
  • 511
  • 2
  • 7
  • 21
5
votes
0 answers

How to benefit from GPU with PYMC3

I see zero difference in PYMC3 speed when using GPU vs. CPU. I am fitting a model that requires 500K+ samples to converge. Obviously it is very slow, so I tried to speed things up with GPU (using GPU instance on EC2). Theano reports to be using GPU,…
volodymyr
  • 7,256
  • 3
  • 42
  • 45
1 2
3
34 35