Custom Step-Taking Function for Basinhopping?

8 views
Skip to first unread message

Peter Wagner

unread,
Jun 3, 2024, 2:18:44 PMJun 3
to pystatsmodels
Hello,

I am trying to fit a SARIMAX model using the basinhopping algorithm. Basinhopping's default step-taking function does not acknowledge the bounds you pass to the local minimizer, allowing it to propose negative sigma2 values. If I set concentrate_scale to True, I circumvent this problem, but I get the following (presumably numerical) errors:

RuntimeWarning: divide by zero encountered in scalar divide
  scale = np.sum(kfilter.scale[d:]) / nobs_k_endog

RuntimeWarning: invalid value encountered in scalar multiply
  loglike += -0.5 * nobs_k_endog * np.log(scale)

The typical solution for basinhopping "ignoring the bounds" is to pass it a custom step-taking function through the take_step argument that incorporates the boundary information. When calling basinhopping through Statsmodels' fit methods, however, there is no built-in way of specifying the take_step argument. Is there some work-around that I can use to pass basinhopping a custom step-taking function? The non-negativity requirement of a default parameter like sigma2 makes me think that this should be a fairly common problem.
Reply all
Reply to author
Forward
0 new messages