 # Inference for loopy graphs?

Can PYMC3 handle graphs that are not DAGs, i.e. there are loops in between? Basically, I have a set of coupled ODEs which I have time-discretized, so that now they look like algebraic equations. However, instead of collecting them all up into a matrix and solving a linear Ax = b like system, I’d like to group the variables according to some other scheme. This introduces several plates some of which (because of the coupling ) have loops between them in the computational graph.

Example: dx/dt = f1(x,y), dy/dt = f2(x,y)
I want to have these two as separate plates so that
x(t+1) = x(t) + dt * f1 (x(t), y(t) ) … plate1
y(t+1) = y(t) + dt * f2(x(t), y(t) ) … plate2

and you have a loop in the computational graph between plate1 and plate2.

Computational graphs have to be DAGs. But I’m not sure I understand how your example would end up with something different. Can you elaborate a bit on that? What do you mean by “plate”?
Maybe this notebook about ODEs in pymc helps you: https://docs.pymc.io/notebooks/ODE_parameter_estimation.html

See the attached image. Maybe my terminology is a messed up, but I refer to the evolution of each variable (x and y) as a plate, and that is because (as I said before) for some reason they cannot be coupled into a single plate.

Just realized that its not technically a “loop”, so apologies for the misnomer. Still, how would one go about implementing this a pymc3 model, without writing it as a vector of solutions X(t) = (x(t), y(t) )