A simple example But run very slow~

Yesterday I install the pymc3.You see,the model is very simple,but the sampling is very very slow.

from my experience, the first time you run a model after installing theano and pymc3 might be slow. But subsequent times speed up.

I’m experiencing the same issue and I need my model to run quickly the first time I run it. Is there anything I could manually cache before running pm.sample() to make it faster? The issue is not the sampling itself, but rather what pymc3 is doing behind the hood before it even assigns the sampler.

I’ve tried running the model as a Python script right after installing all the packages in a fresh environment, but it did not help.

I don’t think you can achieve that with PyMC3. PyMC3 uses Theano (renamed as Aesara), which uses C. That means that the program you run needs to be compiled first in order to be used for sampling.

Is it PyMC3 that needs to compile or is it the model? Would it be possible to run each model once/ a few times so that its compiled to make sure it runs faster afterwards or is their no guarantee that once a model is compiled, it will always run faster/the compiled version will be used? Thank you in advance