Sparse array glm fit in pymc3 very long with NUTS

You can try the sparse matrix from theano in this case - might be able to get some speed up:

from theano import sparse
X_sparse = sparse.csc_from_dense(X)

with pm.Model() as py_lr2:
    intercept = pm.Normal('c', 0, 100)
    betas = pm.Normal('betas', 0, 10, shape=(20, 1))
    sd = pm.HalfNormal('sigma', 5.)
    obs = pm.Normal('y', mu=sparse.basic.dot(X_sparse, betas) + intercept, sigma=sd, observed=y)
1 Like