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
5
votes
1 answer

Rewriting a pymc script for parameter estimation in dynamical systems in pymc3

I'd like to use pymc3 to estimate unknown parameters and states in a Hodgkin Huxley neuron model. My code in pymc is based off of…
5
votes
1 answer

accessing value of a random variable in PyMC3

In PyMC2, there are methods random() and value() to generate a random value, and get the current value of random variables. Is there any way to do the same in PyMC3? p = pm.Dirichlet('p', theta=np.array([1., 1., 1.])) p.random() p.value
ahmethungari
  • 2,089
  • 4
  • 19
  • 21
5
votes
1 answer

Sampling from user provided target densities in PyMC3

Is it possible to sample from a user provided target measure in PyMC3 in an easy way? I.e. I want to be able to provide black box functions logposterior(theta) and grad_logposterior(theta) that and sample from those instead of specifying a model in…
devnull
  • 147
  • 1
  • 5
5
votes
0 answers

PyMC: Hidden Markov Models

How suitable is PyMC in its currently available versions for modelling continuous emission HMMs? I am interested in having a framework where I can easily explore model variations, without having to update E- and M-step, and dynamic programming…
jml
  • 61
  • 4
5
votes
0 answers

PyMC: Estimating population parameters where each observation is the sum of two Weibull-distributed variables

I have a list of n observations, each of which is the sum of two Weibull-distributed variables: x[i] = t1[i] + t2[i] t1[i] ~ Weibull(shape1, scale1) t2[i] ~ Weibull(shape2, scale2) My goal is: 1) Estimate the shape and scale parameters for both…
Danny
  • 450
  • 4
  • 10
5
votes
1 answer

pymc3: parallel computing with njobs>1 vs. GPU

I am trying to speed-up pymc3 sampling with parallelisation and I see only modest benefit. I was able to decrease total running time from 25 minutes (njobs=1) to 13 minutes (njobs=6) on i7 MacBook Pro. Due to the fact that it takes about 4 minutes…
volodymyr
  • 7,256
  • 3
  • 42
  • 45
5
votes
1 answer

PyMC observed data for a sum of random variables

I'm trying to infer models parameters with PyMC. In particular the observed data is modeled as a sum of two different random variables: a negative binomial and a poisson. In PyMC, an algebraic composition of random variables is described by a…
user2304916
  • 7,882
  • 5
  • 39
  • 53
5
votes
1 answer

pymc MAP warning : Stochastic tau's value is neither numerical nor array with floating-point dtype. Recommend fitting method fmin (default)

I have looked at a similar question here pymc warning: value is neither numerical nor array with floating-point dtype but there are no answers, can someone please tell me whether I should ignore this warning or what to do otherwise ? The model has a…
turing
  • 577
  • 1
  • 4
  • 12
5
votes
1 answer

PyMC: Setting Constraints when fitting Models

I am trying to set constraints when fitting variables via a MCMC approach with PyMC For instance, I defined the following stochastic models in PyMC import pymc as…
5
votes
4 answers

KL divergence of continuous pdfs

Say I have two pdfs, e.g.: from scipy import stats pdf_y = stats.beta(5, 9).pdf pdf_x = stats.beta(9, 5).pdf I would like to compute their KL divergence. Before I reinvent the wheel, are there any builtins in the PyData eco-system for doing this?
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
4
votes
0 answers

Can I install pymc version 4 without using conda?

The official instructions only talk about conda: https://www.pymc.io/projects/docs/en/latest/installation.html I'm trying to put pymc into a docker image and I don't want to use conda in the docker image. I just added pymc to requirements.txt, which…
generic_user
  • 3,430
  • 3
  • 32
  • 56
4
votes
1 answer

PyMC3: Different predictions for identical inputs

In PyMC3, single new observations passed via set_data() are currently not handled correctly by sample_posterior_predictive(), which in such cases predicts the training data instead (see #3640). Therefore, I decided to add a second artificial row,…
fdetsch
  • 5,239
  • 3
  • 30
  • 58
4
votes
1 answer

pymc with observations on multiple variables

I'm using an example of linear regression from bayesian methods for hackers but having trouble expanding it to my usage. I have observations on a random variable, an assumed distribution on that random variable, and finally another assumed…
Andrew W
  • 43
  • 4
4
votes
3 answers

Installation issues with PyMC3

I was installing PyMC3 via Anaconda. The transaction execution was done. Post this action, my Anaconda console closes immediately on open. Unable to import PyMC3 module as well. Below is the error message that pops up before the console closes. I…
Naive_Natural2511
  • 687
  • 2
  • 8
  • 20
4
votes
0 answers

trace of likelihood in pymc

Is there a way to access the trace of the likelihood in pymc? I declare the likelihood as: @pymc.observed def likelihood(value=1, data=data, model=model): chi2 = 0.0 [...] return np.exp(-chi2/2.0) But if I attempt the give the following…
Waribiki
  • 113
  • 5