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

Defining a custom PyMC distribution

This is perhaps a silly question. I'm trying to fit data to a very strange PDF using MCMC evaluation in PyMC. For this example I just want to figure out how to fit to a normal distribution where I manually input the normal PDF. My code is: data =…
stellographer
  • 373
  • 3
  • 11
9
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
  • 503
  • 4
  • 15
9
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,341
  • 1
  • 16
  • 35
9
votes
3 answers

Making Probability Distribution Functions (PDFs) from histograms

Say I have several histograms, each with counts at different bin locations (on a real axis). e.g. def generate_random_histogram(): # Random bin locations between 0 and 100 bin_locations = np.random.rand(10,) * 100 …
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
9
votes
1 answer

How to model a mixture of 3 Normals in PyMC?

There is a question on CrossValidated on how to use PyMC to fit two Normal distributions to data. The answer of Cam.Davidson.Pilon was to use a Bernoulli distribution to assign data to one of the two Normals: size = 10 p = Uniform( "p", 0 , 1) #this…
Michael Schubert
  • 2,726
  • 4
  • 27
  • 49
8
votes
1 answer

Randomizing network using pymc in Python

There are two columns in the dataset, user_id, and site_name respectively. It records every site name that every user browsed. toy_dict = {'site_name': {0: u'\u4eac\u4e1c\u7f51\u4e0a\u5546\u57ce', 1: u'\u963f\u91cc\u4e91', 2:…
Swimming
  • 91
  • 4
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
8
votes
1 answer

Custom likelihood in pymc3

How can I define a custom likelihood in PyMC3? In PyMC2, I could use @pymc.potential. I tried to use pymc.Potential in PyMC3, however, it seems that boolean operations cannot be applied to the parameters (I get an error like this when I do that).…
Amir Dezfouli
  • 199
  • 3
  • 10
8
votes
0 answers

Fitting a non-homogeneous poisson-process with PyMC

I'm new to PyMC and trying to fit my non-homogeneous poisson-process with a piecewise-constant rate function using the maximum a posteriori estimate. My process describes some events during a day. Therefore i'm splitting a day into 24 hours, which…
sascha
  • 32,238
  • 6
  • 68
  • 110
8
votes
3 answers

Anaconda Pymc Install

When attempting to install pymc via conda, I receive the following: C:\Anaconda>conda install -c https://conda.binstar.org/pymc pymc Fetching package metadata: ... Error: No packages found matching: pymc The install is from the pymc distribution…
Gene
  • 1,587
  • 4
  • 18
  • 38
8
votes
0 answers

pymc warning: value is neither numerical nor array with floating-point dtype

I have a Bayes net (DAG) model which I created using pymc 2.3. All the variables in it are Bernoulli random variables. When I call the MAP.fit() method on it before sampling I get the following warning for all of my random variables: value is…
Yair
  • 1,325
  • 2
  • 13
  • 18
8
votes
1 answer

Hidden Markov in PyMC3

I have a multivariate Monte-Carlo Hidden Markov problem to solve: x[k] = f(x[k-1]) + B u[k] y[k] = g(x[k]) where: x[k] the hidden states (Markov dynamics) y[k] the observed data u[k] the stochastic driving process Is PyMC3 already mature…
stustd
  • 303
  • 1
  • 10
7
votes
1 answer

PYMC3 Bayesian Prediction Cones

I'm still learning PYMC3, but I cannot find anything on the following problem in the docs. Consider the Bayesian Structure Time Series (BSTS) model from this question with no seasonality. This can be modeled in PYMC3 as follows: import pymc3, numpy,…
Paul
  • 503
  • 4
  • 15
7
votes
1 answer

How to set Bernoulli distribution parameters in pymc3

I have a model described in pymc3 using the following: from pymc3 import * basic_model = Model() with basic_model: # Priors for unknown model parameters alpha = Normal('alpha', mu=0, sd=10) beta = Normal('beta', mu=0, sd=10,…
recluze
  • 1,920
  • 4
  • 21
  • 34
7
votes
1 answer

Stochastic Optimization in Python

I am trying to combine cvxopt (an optimization solver) and PyMC (a sampler) to solve convex stochastic optimization problems. For reference, installing both packages with pip is straightforward: pip install cvxopt pip install pymc Both packages…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
1
2
3
34 35