Questions tagged [pymc3]

PyMC (formerly 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, PyMC 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.

706 questions
3
votes
0 answers

pymc3 likelihood math with non-theano function

I'm new to doing Bayesian inference. I'm trying to adapt a grid search code I wrote to Bayesian Monte Carlo Markov Chain approach, and I'm using PyMC3. My problem is that the code has to call a function that can't be rewritten in theano syntax. …
3
votes
0 answers

Hierarchical Dirichlet Process in PyMC3

I'm trying to implement Hierarchical Dirichlet Process (HDP) topic model using PyMC3. The HDP graphical model is shown below: I came up with the following code: import numpy as np import scipy as sp import pandas as pd import seaborn as sns import…
Vadim Smolyakov
  • 1,187
  • 11
  • 24
3
votes
2 answers

Anaconda conda install pymc: Compilation failed on import

My goal is to install PyMC3 with Python3 on Mac OS 10.10.5. My following approach failed: I checked Theano website and saw that Python 3.6 was not yet supported. So I went for Python 3.5, using…
6iW5A
  • 31
  • 3
3
votes
1 answer

Multiple levels in hierarchical linear regression using PYMC3

I am trying to set up a hierarchical linear regression model using PYMC3. In my particular case, I want to see whether postal codes provide a meaningful structure for other features. Suppose I use the following mock data: import pandas as pd import…
swebbo
  • 308
  • 1
  • 7
3
votes
1 answer

How to add constraints to parameters in pymc3 model?

I followed the first tutorial in pymc3 concerning a linear regression. I tried to adapt it to a different function that is : Y_obs = log (x+a)^2 / (x-c)^2 As you can see it could be preferable that c was negative. Thus I wonder how to define the…
Ger
  • 9,076
  • 10
  • 37
  • 48
3
votes
1 answer

Difference between BetaBinomial and "Beta and Binomial"

I created two models in pymc3. One is with pm.BetaBinomial and another is with pm.Beta and pm.Binomial. If we use pymc3.BetaBinomial, $\alpha$ and $\beta$ converge. import numpy as np from scipy.stats import binom, beta import pymc3 as…
H. Shindoh
  • 906
  • 9
  • 23
3
votes
1 answer

Basic Bayesian Linear Regression prediction with PyMC3

I would like to use my PyMC3 LR model to get an 80% HPD range for the value of the predicted variable y as new data becomes available. Thus, extrapolate a credible distribution of values for y for a new value of x not in my original…
Nel
  • 101
  • 10
3
votes
1 answer

Interpretation of variables in multi-level regression with random effects

I have a dataset that looks like the one below (first 5 rows shown). CPA is an observed result from an experiment (treatment) on different advertising flights. Flights are hierarchically grouped in campaigns. campaign_uid flight_uid treatment …
3
votes
0 answers

Bayes PCA doesn't recover the Principal Components in PyMC3

I'd like to implement a hierarchical bayesian model with PyMC3. Before designing a complex model, I'm trying to get accustomed with PyMC3 by implementing Bayes PCA and comparing the results with sklearn.decomposition.pca In 1: %matplotlib…
3
votes
1 answer

PYMC3: NUTS has difficulty sampling from a hierarchical zero inflated gamma model

I'm trying to replicate the data analysis from a paper from Richard McElreath, in which he fitted the data with a hierarchical zero inflated Gamma model. The data is about the hunting returns of around 15000 hunting trips from about 150 hunters over…
Olivier Ma
  • 1,269
  • 13
  • 24
3
votes
1 answer

Predicting Posterior for New Data in Bayesian Linear Regression Using PyMC3

Using PyMC3 to perform bayesian linear regression. I built my model, and I want to predict the posterior for new X values using the same model. I have been attempting to follow the instructions at the documentation website:…
Flow Nuwen
  • 547
  • 5
  • 20
3
votes
1 answer

Bayesian Correlation with PyMC3

I'm trying to convert this example of Bayesian correlation for PyMC2 to PyMC3, but get completely different results. Most importantly, the mean of the multivariate Normal distribution quickly goes to zero, whereas it should be around 400 (as it is…
sebp
  • 260
  • 2
  • 8
3
votes
1 answer

Observed Deterministic in pymc3

I am trying to port a model from Infer.NET, and I am struggling with how can I make a Deterministic variable observed in pymc3? M,L ~ Bernoulli # doesn't work ... Deterministic("U %i" % i, switch(M[i], ~L[i], L[i]), observed=True)
kyrre
  • 626
  • 2
  • 9
  • 24
3
votes
0 answers

Using theano.scan in pymc3 models

I'm trying to infer parameters of a stochastic dynamical system using pymc3. I have a theano expression that seems to come together without errors, but I can't seem to compile it, which I was hoping to do in order to generate toy data for fitting.…
Noah
  • 196
  • 10
3
votes
0 answers

PyMC3 - Index 2-dimensional data while fitting hierarchical autoregressive model

I (new to PyMC3) want to extend the model proposed in the PyMC3 example A Hierarchical model for Rugby prediction by making the latent variables for attack and defence strength autoregressive. I am unsure about how to use 2-dimensional data and the…
Moritz
  • 31
  • 4