Repository navigation
ENH: add optim_kwds_prelim to count models in discrete_model - #3928
Conversation
|
This will cause some test failures. The only change in default method is in GPP, which used the same method for prelim as for the final model. next on plan: use null model for poisson start_params which might solve some failures. |
|
only two failures, both in tough cases: I also have the first one in TestGeneralizedPoisson_underdispersion.test_newton locally on my computer edit: the test failure is in "nm" score, the newton with fixed start_params from nm looks good the second one looks like a bfgs failure in older scipy, not a failure locally with scipy 0.8 |
|
continuing TestGeneralizedPoisson_underdispersion.test_newton this is a good test case for the next change: use proper start_params for the extra_params, alpha final "newton" estimate is Because we have under dispersion, GPP with alpha < 0, the fixed default start_params for alpha of 0.1 does not work for newton. |
|
two new test precision failures, that shouldn't have been affected by the test adjustments (commit "TST: adjust tests, precision, and prelim method in GPP") more likely something changed in the travis environment. (In the test adjustment I forgot to increase maxiter for nm, which I guess is the reason that one of the new tests still fails.) |
|
NBP also fails in the optim_kwds_prelim test with "bfgs" on scipy < 0.18. And here are the 2 failing diagnostics test |
|
NBP test in test_optim_kwds_prelim still fails on older scipy. |
|
after using alpha prelim estimate: |
|
ZINBP test case is another nasty corner case: there is no zero-inflation in the data when negbin is used. bfgs result in different inflation parameters but has 'nm' is similar (but I don't have the number anymore on the shell screen) I'm not getting into fixing zero-inflation corner solutions for now, so I will cheat in this test. The inflation start_params are fixed at zeros, and I won't change them now. And even when we improve convergence behavior, we need to work with an "identified" model and not this dataset. |
|
on travisciL test_optim_kwds_prelim() NBP still fails, but now it's scipy <= 0.16 (I didn't check those logs before) however, assert is for start_params not for the final estimate of params maybe incorrect test logic, if different methods don't converge to the same params. |
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #3928 +/- ##
==========================================
+ Coverage 78.97% 78.98% +<.01%
==========================================
Files 541 541
Lines 80818 80872 +54
Branches 9185 9188 +3
==========================================
+ Hits 63829 63879 +50
- Misses 14915 14917 +2
- Partials 2074 2076 +2
Continue to review full report at Codecov.
|
|
Finally everything green. still to come: add alpha start_params also for NegativeBinomial After I make the change (only) two tests fail TestNegativeBinomialNBP1Null.test_start_null TestNegativeBinomialNBP2Null.test_start_null because the alpha start_params for the null model are not the same anymore. |
|
another test failure this time in 3 TestNegbinClu test classes that all use bfgs (default) for the same model. |
|
as green as it gets (one statespace simulate hang again on appveyor) what I haven't checked yet is how good the moment estimator for alpha is at the final mu and alpha. (But I don't see a use case yet when we already have the final estimate. For the preliminary estimate it will be useful also as a diagnostic check, and could be made into a staticmethod or classmethod.) |
see #3925 and #3578
changes and additions implemented
optim_kwds_prelimfor all count models in discrete_modelchanges one propagated fit method compared to master (in GPP)
some adjustments in unit tests, mainly to avoid problems with bfgs in older scipy
missing: improve start_params for Zero Inflation
Aside because it showed up in a test case:
If the start_params are changed as in this PR, then it is possible that the estimator converges to a different result within specified convergence tolerance.
We can only replicate or compare subject to tolerance provided by convergence criteria.
a remaining issue in unit tests, see comment below
#3928 (comment)
Estimating zero-inflation has convergence problems when there is no zero-inflation in the data.
unit test for ZINBP2 now "cheats" by using rounded params as start_params
(note there are also comment about this case in the ZI PRs, AFAIR)
closes #3578