pymc

Trying to install pymc on Anaconda(python) in Windows 7 and getting weird error?

允我心安 提交于 2019-12-02 07:58:34
I want to run some data science algorithms using Markov Chain Monte Carlo for Bayesian analysis and am trying to install PyMC but am frustratingly getting this error... File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\gnu.py", line 333, in get_libraries raise NotImplementedError("Only MS compiler supported with gfortran on win64") NotImplementedError: Only MS compiler supported with gfortran on win64 Why would this happen and what can I do to solve it that doesnt require me hacking up python and apparently numpy that might screw other things up at a later time? It turns out if I

Fitting a capped Poisson process with a variable rate

烂漫一生 提交于 2019-12-01 23:48:13
问题 I'm trying to estimate the rate of a Poisson process where the rate varies over time using the maximum a posteriori estimate. Here's a simplified example with a rate varying linearly (λ = ax+b) : import numpy as np import pymc # Observation a_actual = 1.3 b_actual = 2.0 t = np.arange(10) obs = np.random.poisson(a_actual * t + b_actual) # Model a = pymc.Uniform(name='a', value=1., lower=0, upper=10) b = pymc.Uniform(name='b', value=1., lower=0, upper=10) @pymc.deterministic def linear(a=a, b=b

Fitting a capped Poisson process with a variable rate

﹥>﹥吖頭↗ 提交于 2019-12-01 20:58:30
I'm trying to estimate the rate of a Poisson process where the rate varies over time using the maximum a posteriori estimate. Here's a simplified example with a rate varying linearly (λ = ax+b) : import numpy as np import pymc # Observation a_actual = 1.3 b_actual = 2.0 t = np.arange(10) obs = np.random.poisson(a_actual * t + b_actual) # Model a = pymc.Uniform(name='a', value=1., lower=0, upper=10) b = pymc.Uniform(name='b', value=1., lower=0, upper=10) @pymc.deterministic def linear(a=a, b=b): return a * t + b r = pymc.Poisson(mu=linear, name='r', value=obs, observed=True) model = pymc.Model(

How to write a custom Deterministic or Stochastic in pymc3 with theano.op?

笑着哭i 提交于 2019-12-01 10:29:54
I'm doing some pymc3 and I would like to create custom Stochastics, however there doesn't seem to be a lot documentation about how it's done. I know how to use the as_op way , however apparently that makes it impossible to use the NUTS sampler, in which case I don't see the advantage of pymc3 over pymc. The tutorial mentions that it can be done by inheriting from theano.Op. But can anyone show me how that would work (I'm still getting started on theano)? I have two Stochastics that I want to define. The first one should be easier, it's an N dimension vector F that has only constant parent

How to write a custom Deterministic or Stochastic in pymc3 with theano.op?

∥☆過路亽.° 提交于 2019-12-01 07:36:41
问题 I'm doing some pymc3 and I would like to create custom Stochastics, however there doesn't seem to be a lot documentation about how it's done. I know how to use the as_op way, however apparently that makes it impossible to use the NUTS sampler, in which case I don't see the advantage of pymc3 over pymc. The tutorial mentions that it can be done by inheriting from theano.Op. But can anyone show me how that would work (I'm still getting started on theano)? I have two Stochastics that I want to

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

给你一囗甜甜゛ 提交于 2019-12-01 03:06:57
问题 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 variation of the model using LKJCorr priors for the correlation matrices and uniform priors for the standard deviations. In the original model, the covariance matrices are drawn from Wishart distributions, but due to current limitations of pymc3 , the

PyMC - variance-covariance matrix estimation

匆匆过客 提交于 2019-12-01 01:59:35
I read the following paper( http://www3.stat.sinica.edu.tw/statistica/oldpdf/A10n416.pdf ) where they model the variance-covariance matrix Σ as: Σ = diag(S)*R*diag(S) (Equation 1 in the paper) S is the k×1 vector of standard deviations, diag(S) is the diagonal matrix with diagonal elements S, and R is the k×k correlation matrix. How can I implement this using PyMC ? Here is some initial code I wrote: import numpy as np import pandas as pd import pymc as pm k=3 prior_mu=np.ones(k) prior_var=np.eye(k) prior_corr=np.eye(k) prior_cov=prior_var*prior_corr*prior_var post_mu = pm.Normal("returns"

Anaconda - UnsatisfiableError: The following specifications were found to be in conflict

吃可爱长大的小学妹 提交于 2019-12-01 00:52:22
问题 When I was trying to install a module 'pymc' through anaconda environments, it showed the error message as follows: UnsatisfiableError: The following specifications were found to be in conflict: blaze -> pyyaml -> python[version='>=2.7,<2.8.0a0'] -> vc=9 blaze -> pyyaml -> yaml -> *[track_features=vc9] pymc Use "conda info " to see the dependencies for each package. I am using Python 2.7.14, and I installed anaconda 1.6.9 on a Windows. I am new to Python. I first tried to use cmd to install

Custom priors in PyMC

流过昼夜 提交于 2019-11-30 16:00:25
问题 Say I want to put a custom prior on two variables a and b in PyMC, e.g.: p(a,b)∝(a+b)^(−5/2) (for the motivation behind this choice of prior, see this answer) Can this be done in PyMC? If so how? As an example, I would like to define such prior on a and b in the model below. import pymc as pm # ... # Code that defines the prior: p(a,b)∝(a+b)^(−5/2) # ... theta = pm.Beta("prior", alpha=a, beta=b) # Binomials that share a common prior bins = dict() for i in xrange(N_cities): bins[i] = pm

Custom priors in PyMC

北城以北 提交于 2019-11-30 15:43:12
Say I want to put a custom prior on two variables a and b in PyMC, e.g.: p(a,b)∝(a+b)^(−5/2) (for the motivation behind this choice of prior, see this answer ) Can this be done in PyMC? If so how? As an example, I would like to define such prior on a and b in the model below. import pymc as pm # ... # Code that defines the prior: p(a,b)∝(a+b)^(−5/2) # ... theta = pm.Beta("prior", alpha=a, beta=b) # Binomials that share a common prior bins = dict() for i in xrange(N_cities): bins[i] = pm.Binomial('bin_{}'.format(i), p=theta,n=N_trials[i], value=N_yes[i], observed=True) mcmc = pm.MCMC([bins, ps]