Skip to content

REF/BUG: ARMA/ARIMA increase default maxiter in fit - #4004

Merged
josef-pkt merged 3 commits into
statsmodels:masterfrom
josef-pkt:tst_arima_3980
Oct 9, 2017
Merged

josef-pkt merged 3 commits into
statsmodels:masterfrom
josef-pkt:tst_arima_3980

Conversation

@josef-pkt

@josef-pkt josef-pkt commented Oct 9, 2017 •

Copy link
Copy Markdown
Member

closes #3980 test_arima111_predict_exog_2127 test fails again in some test environments

first try: Tighten pgtol for lbfgs optimization in test - pgtol was already at the tighter level
relevant change: increase maxiter in ARMA/ARIMA
bonus: add iterations to lbfgs mle_retvals

Note point of test was not precision issues, just that exog is transmitted properly.
If this doesn't work, then we just increase test tolerance again.

As check: gopt in mle_retvals is much smaller than the explicitly computed score with lbfgs.
However, the predictions agree with solver='newton' at an atol around 5e-7,
solver='newton' works well starting from the lbfgs params and has very small score at optimum, in contrast to lbfgs.

The newton predicts also agree with those used in the unit test at around atol 5e-7. so those are not very noisy.

I'm using scipy '0.18.1'

@josef-pkt

Copy link
Copy Markdown
Member Author

maxiter=50 in ARIMA.fit seems to be very low to me

@josef-pkt

Copy link
Copy Markdown
Member Author

One more try to see what's going on, before giving up again

I added an assert that warnflag for converged is equal 0.
amended and force pushed

(I don't see a scipy change that would account for worse convergence behavior in fmin.l_bfgs_b)

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.02%) to 81.627% when pulling 97c90c6 on josef-pkt:tst_arima_3980 into 99c9e19 on statsmodels:master.

@josef-pkt

josef-pkt commented Oct 9, 2017 •

Copy link
Copy Markdown
Member Author

Ok, this wasn't so useful so far (except for getting a bit of info about lbfgs in ARIMA)

ARMA.fit towards the bottom of the method defines already pgtol at 1e-8 before calling super

factr seems too small to me, (which I guess makes it a non-binding convergence criterion)
no idea what the 'm' does, i.e. what's a good range for it

    if solver == 'lbfgs':
            kwargs.setdefault('pgtol', 1e-8)
            kwargs.setdefault('factr', 1e2)
            kwargs.setdefault('m', 12)
            kwargs.setdefault('approx_grad', True)

@josef-pkt

Copy link
Copy Markdown
Member Author

warnflag is informative

E           AssertionError: 
E           Items are not equal:
E            ACTUAL: 1
E            DESIRED: 0

1 if too many function evaluations or too many iterations,

so maxiter or maxfun
AFAICS, maxfun is not changed in our code, maxiter is much too small at 50, scipy default 15000

@josef-pkt

Copy link
Copy Markdown
Member Author

one more change (will push when green)

add iterations = d['nit'] to mle_retvals for lbfgs

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0002%) to 81.642% when pulling 4a4b8c2 on josef-pkt:tst_arima_3980 into 99c9e19 on statsmodels:master.

1 similar comment
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0002%) to 81.642% when pulling 4a4b8c2 on josef-pkt:tst_arima_3980 into 99c9e19 on statsmodels:master.

@josef-pkt

Copy link
Copy Markdown
Member Author

Travis is all green, maxiter was the problem

@josef-pkt

Copy link
Copy Markdown
Member Author

should be ready to merge when green

@josef-pkt josef-pkt changed the title TST: tighten convergence tolerance in test_arima111_predict_exog_2127 REF/BUG: ARMA/ARIMA increase default maxiter in fit Oct 9, 2017
@josef-pkt

Copy link
Copy Markdown
Member Author

aside:
With the version I use, lbfgs converges in the test case with 51 iterations which is also the stopping point for the (old) maxiter=50, i.e. barely converged. Any slightly slower convergence will have maxiter binding, but not necessarily cause a test failure, not if the estimate is already close enough to convergence.

@codecov-io

codecov-io commented Oct 9, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #4004 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4004      +/-   ##
==========================================
- Coverage   79.06%   79.06%   -0.01%     
==========================================
  Files         542      542              
  Lines       81016    81018       +2     
  Branches     9202     9202              
==========================================
  Hits        64055    64055              
- Misses      14872    14873       +1     
- Partials     2089     2090       +1
Impacted Files Coverage Δ
statsmodels/tsa/arima_model.py 84.38% <ø> (ø) ⬆️
statsmodels/base/optimizer.py 79.82% <100%> (+0.09%) ⬆️
statsmodels/tsa/tests/test_arima.py 99.3% <100%> (ø) ⬆️
statsmodels/tsa/vector_ar/vecm.py 93.62% <0%> (-0.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 99c9e19...79ebe41. Read the comment docs.

@coveralls

coveralls commented Oct 9, 2017 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.0008%) to 81.641% when pulling 79ebe41 on josef-pkt:tst_arima_3980 into 99c9e19 on statsmodels:master.

@josef-pkt
josef-pkt merged commit ea506de into statsmodels:master Oct 9, 2017
@josef-pkt
josef-pkt deleted the tst_arima_3980 branch October 9, 2017 22:30
@josef-pkt josef-pkt mentioned this pull request Oct 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TST failing test_arima111_predict_exog_2127 again and again

3 participants