Simplified syntax for control flows like loops and if/else switches?

Hi,
inspired by two recent topics (one by me: Probabilistic model with deterministic switch and this topic on loping: Best Way to Handle a for Loop in pymc4), I wanted to ask two general questions:

  • Are there good examples in the documentation about these topics? I am not aware of any, perhaps there are and I’ve just missed them. If there aren’t, I think it would be nice to have some examples for those, because honestly, I even thought that using control flow operations like loops or if/else switches in pymc models is not possible at all.

  • Would it be feasible to simplify the usability of these operations such that the user is not required to use the aesara operations but can leverage some simpified pymc syntax perhaps? I was thinking whether it might be possible to create something like pymc.for and pymc.if that could be used almost like the standard python for and if/else and be internally translated into aesara.scan() and aesara.switch, respectively.

1 Like