Hi Junpeng,
Thank you for your suggestions! I managed to integrate a few of them, and my first model seems to be working fine now, well enough for my purposes. (Alpha and beta are correlated in the model, which I think might be a problem, but all RL model have this problem and I hope it’s not crucial.)
Nevertheless, I still have problems with the second version of the model. It is impressive how such a small difference can change so much. I am pretty certain that my model is reasonable because I simulated data from it, and it looks very similar to the empirical data that I am trying to fit, so I am replicating the important patterns. Still, the model either errs with ValueError: Bad initial energy: inf. The model might be misspecified. or, if it runs, it gets stuck immediately:
Here is the code for my model, based on your code (note that this is a .ipynb file, I just changed the extension to .txt to be able to upload it here): discourse_1735.txt (13.7 KB)

