Specifying More Initialization Attempts

Dear wonderful Stan community,

I have a general question that has come up in a number of models I’ve seen. We’ve all encountered that obnoxious message: “Initialization between (-2, 2) failed after 100 attempts.” Often, I react using the recommendations immediately following that error (declaring initial values, reducing ranges, or altogether re-specifying some things). However, for some of my more obstinate models, the most efficient, brute-force way around this simply has me re-run the code a few times, and then boom it works. (By “a few” I mean 5-10. I’m not that crazy!)

Here’s my question: Can you tell rstan how many attempts to make before giving up? That is, can we change the default 100 attempts?

Thank you for your time, humor, and steadfast wisdom.

1 Like

Be sure to send examples of those “eventually initializes” models to the Pathfinder crew.

1 Like

The number of initializations is not currently customizable, but it’s a one-line change in the C++ for anyone willful enough to want the brute force solution.

I could go on about how even needing 100 attempts indicates modeling problems that should be taken care of and increasing the number of attempts only ignores those problems, but that’s a separate discussion!