Questions tagged [pymc3]

PyMC3 is a python module that implements Bayesian statistical models and fitting algorithms, including Markov chain Monte Carlo. Its flexibility and extensibility make it applicable to a large suite of problems. Along with core sampling functionality, PyMC3 includes methods for summarizing output, plotting, goodness-of-fit and convergence diagnostics.

PyMC is a python module that implements Bayesian statistical models and fitting algorithms, including Markov chain Monte Carlo. Its flexibility and extensibility make it applicable to a large suite of problems. Along with core sampling functionality, PyMC includes methods for summarizing output, plotting, goodness-of-fit and convergence diagnostics.

Source: http://pymc-devs.github.io/pymc/README.html#purpose

Docs: https://pymc-devs.github.io/pymc3/

651 questions
21
votes
2 answers

Generating predictions from inferred parameters in pymc3

I run into a common problem I'm wondering if someone can help with. I often would like to use pymc3 in two modes: training (i.e. actually running inference on parameters) and evaluation (i.e. using inferred parameters to generate predictions). In…
santon
  • 3,517
  • 1
  • 17
  • 36
20
votes
2 answers

PyMC3 Bayesian Linear Regression prediction with sklearn.datasets

I've been trying to implement Bayesian Linear Regression models using PyMC3 with REAL DATA (i.e. not from linear function + gaussian noise) from the datasets in sklearn.datasets. I chose the regression dataset with the smallest number of attributes…
O.rka
  • 24,289
  • 52
  • 152
  • 253
16
votes
1 answer

What is a chain in PyMC3?

I am learning PyMC3 for Bayesian modeling. You can create a model and sample with: import pandas as pd import pymc3 as pm # obs is a DataFrame with a single column, containing # the observed values for variable height obs = pd.DataFrame(...) # we…
gc5
  • 8,206
  • 20
  • 76
  • 137
15
votes
1 answer

How to extract unsupervised clusters from a Dirichlet Process in PyMC3?

I just finished the Bayesian Analysis in Python book by Osvaldo Martin (great book to understand bayesian concepts and some fancy numpy indexing). I really want to extend my understanding to bayesian mixture models for unsupervised clustering of…
O.rka
  • 24,289
  • 52
  • 152
  • 253
12
votes
2 answers

Can a PyMC3 trace be loaded and values accessed without the original model in memory?

I'm still learning the basics of working with PyMC3 so hopefully this isn't too painfully obvious in the documentation already. The basic idea is that I have put together my model, sampled it a bunch to build up my posterior distribution and saved…
strwrsdbz
  • 129
  • 2
  • 9
12
votes
1 answer

how to speed up PyMC markov model?

Is there a way to speed up this simple PyMC model? On 20-40 data points, it takes ~5-11 seconds to fit. import pymc import time import numpy as np from collections import OrderedDict # prior probability of rain p_rain = 0.5 variables =…
yyk
  • 661
  • 1
  • 5
  • 7
10
votes
2 answers

PyMC3 & Theano - Theano code that works stop working after pymc3 import

Some simple theano code that works perfectly, stop working when I import pymc3 Here some snipets in order to reproduce the error: #Initial Theano Code (this works) import theano.tensor as tsr x = tsr.dscalar('x') y = tsr.dscalar('y') z = x +…
Samoht-Sann
  • 246
  • 1
  • 8
10
votes
2 answers

pymc3 : Multiple observed values

I have some observational data for which I would like to estimate parameters, and I thought it would be a good opportunity to try out PYMC3. My data is structured as a series of records. Each record contains a pair of observations that relate to…
sozen
  • 115
  • 1
  • 5
10
votes
2 answers

Parallelization of PyMC

Could someone give some general instructions on how one can parallelize the PyMC MCMC code. I am trying to run LASSO regression following the example given here. I read somewhere that parallel sampling is done by default, but do I still need to use…
cmlakhan
  • 117
  • 1
  • 7
9
votes
3 answers

How to make a truncated normal prior: converting pymc2 to pymc3

In pymc3 how does one configure a truncated normal prior? In pymc2 it's pretty straightforward (below), but in pymc3 it seems there is no longer a truncated normal distribution available. Pymc2: TruncatedNormal('gamma_own_%i_' % i, mu=go,…
Kemp
  • 91
  • 6
8
votes
1 answer

PYMC3 Seasonal Variables

I'm relatively new to PYMC3 and I'm trying to implement a Bayesian Structure Time Series (BSTS) without regressors, for instance the model fit here in R. The model is as follows: I can implement the local linear trend using a GaussianRandomWalk as…
Paul
  • 453
  • 2
  • 12
8
votes
3 answers

how to fit a method belonging to an instance with pymc3?

I failed to fit a method belonging to an instance of a class, as a Deterministic function, with PyMc3. Can you show me how to do that ? For simplicity, my case is summarised below with a simple example. In reality, my constraint is that everything…
Stéphane
  • 1,243
  • 3
  • 11
  • 32
8
votes
1 answer

Incremental model update with PyMC3

Is it possible to incrementally update a model in pyMC3. I can currently find no information on this. All documentation is always working with a priori known data. But in my understanding, a Bayesian model also means being able to update a belief.…
Christian
  • 1,039
  • 1
  • 12
  • 30
8
votes
2 answers

Calculate maximum likelihood using PyMC3

There are cases when I'm not actually interested in the full posterior of a Bayesian inference, but simply the maximum likelihood (or maximum a posterior for suitably chosen priors), and possibly it's Hessian. PyMC3 has functions to do that, but…
burnpanck
  • 1,718
  • 8
  • 26
8
votes
0 answers

Problems with a hidden Markov model in PyMC3

To learn PyMC, I'm trying to do a simple Hidden Markov Model as shown below: with pymc3.Model() as hmm: # Transition "matrix" a_t = np.ones(num_states) T = [pymc3.Dirichlet('T{0}'.format(i), a = a_t, shape = num_states) for i in…
Javier C.
  • 137
  • 7
1
2 3
43 44