Solving Inverse problem using pyMC

Hi @salmanromeo40
So in theory you can just write an arbitrary generative model and use that to sample. In practice, there needs to be a way to calculate gradient information (not just calculate log probabilities). In PyMC models, there this is done by building up a symbolic graph in Aesara and that gives us the gradients. There is some level of numpy/python code that can be included in PyMC models which can be ‘understood’ and used to generate Aesara graphs, but there is a certain point at which this breaks. The exact point, I do not fully understand (maybe @ricardoV94 can shed light on this).

But your model seems to include multiple (partially redacted) functions. If these are complex then it might not be possible for it to be parsed into an Aesara graph and so the gradient information isn’t available. In these cases, the general approach would be to write your functions using Aesara operations, rather than raw Python or numpy operations.

2 Likes