probabilistic-programming

Error: non-constant-expression cannot be narrowed from type 'npy_intp' to 'int'

浪子不回头ぞ 提交于 2020-05-10 21:14:13
问题 I am trying to run the following model, but it fails during compilation: import numpy as np import pymc3 as pm def sample_data(G=1, K=2): # mean proportion ([0,1]) for each g p_g = np.random.beta(2, 2, size=G) # concentration around each p_g c_g = np.random.lognormal(mean=0.5, sigma=1, size=G) # reparameterization for standard Beta(a,b) a_g = c_g * p_g / np.sqrt(p_g**2 + (1.-p_g)**2) b_g = c_g*(1.-p_g) / np.sqrt(p_g**2 + (1.-p_g)**2) # for each p_g, sample K proportions p_gk = np.random.beta

Error: non-constant-expression cannot be narrowed from type 'npy_intp' to 'int'

﹥>﹥吖頭↗ 提交于 2020-05-10 21:13:17
问题 I am trying to run the following model, but it fails during compilation: import numpy as np import pymc3 as pm def sample_data(G=1, K=2): # mean proportion ([0,1]) for each g p_g = np.random.beta(2, 2, size=G) # concentration around each p_g c_g = np.random.lognormal(mean=0.5, sigma=1, size=G) # reparameterization for standard Beta(a,b) a_g = c_g * p_g / np.sqrt(p_g**2 + (1.-p_g)**2) b_g = c_g*(1.-p_g) / np.sqrt(p_g**2 + (1.-p_g)**2) # for each p_g, sample K proportions p_gk = np.random.beta

Error: non-constant-expression cannot be narrowed from type 'npy_intp' to 'int'

三世轮回 提交于 2020-05-10 21:12:07
问题 I am trying to run the following model, but it fails during compilation: import numpy as np import pymc3 as pm def sample_data(G=1, K=2): # mean proportion ([0,1]) for each g p_g = np.random.beta(2, 2, size=G) # concentration around each p_g c_g = np.random.lognormal(mean=0.5, sigma=1, size=G) # reparameterization for standard Beta(a,b) a_g = c_g * p_g / np.sqrt(p_g**2 + (1.-p_g)**2) b_g = c_g*(1.-p_g) / np.sqrt(p_g**2 + (1.-p_g)**2) # for each p_g, sample K proportions p_gk = np.random.beta

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

巧了我就是萌 提交于 2019-12-22 07:05:14
问题 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 Weibull distributions (shape1, scale1, shape2, scale2), 2) For each observation x[i], estimate t1[i] (and t2[i] follows from this). ( Aside: Each observation x[i] is the age of cancer diagnosis, and t1[i] and t2[i] are two different time periods in the

How to use pymc to parameterize a probabilistic graphical model?

元气小坏坏 提交于 2019-12-10 14:43:26
问题 How can one use pymc to parameterize a probabilistic graphical model? Suppose I have a PGM with two nodes X and Y . Lets say X->Y is the graph. And X takes two values {0,1} , and Y also takes two values {0,1} . I want to use pymc to learn the parameters of the distribution and populate the graphical model with it for running inferences. The way I could think of is as follows: X_p = pm.Uniform("X_p", 0, 1) X = pm.Bernoulli("X", X_p, values=X_Vals, observed=True) Y0_p = pm.Uniform("Y0_p", 0, 1)