I used the below code to install and import pymc on google colab.
! pip install pymc
import pymc as pm
For every model I ran, it has a warning as below:
WARNING:aesara.tensor.blas:We did not find a dynamic library in the library_dir of the library we use for blas. If you use ATLAS, make sure to compile it with dynamics library.
My model is as below. Each iteration takes about 8 seconds.
with pm.Model() as model:
## parameters to estimate
# coefficient of x
b0_e = pm.Normal('b0', 0, sigma = 100)
b1_e = pm.Normal('b1', 0, 100, shape= x.shape[1])
# portion of non-zero
pi_e = pm.Beta("pi", alpha=1, beta=1)
# negative binomial - alpha
alpha_e = pm.Gamma("alpha", alpha=1, beta=1)
## get the mu
mu_u = np.exp(b0_e + pm.math.matrix_dot(x, b1_e))
likelihood = pm.ZeroInflatedNegativeBinomial('y', psi = pi_e, mu = mu_u, alpha = alpha_e, observed = y)
# Inference!
# draw 3000 posterior samples using NUTS
trace = pm.sample(2000, return_inferencedata=True)
If I install pymc3 (! pip install pymc3), then there is also a similar warning below
WARNING:theano.tensor.blas:We did not find a dynamic library in the library_dir of the library we use for blas. If you use ATLAS, make sure to compile it with dynamics library.
However, with pymc3 and the exact same code and data, each iteration takes 1.2 seconds.
I wonder if there is anyone knows why there is a large difference between using pymc3 and pymc4. And how to resolve the warning and hopefully increase the speed. Thanks!