Skip to content

REF/Design: mle_settings, replicating fit  #2401

Open

Description

@josef-pkt

I'm writing unit tests at high precision (e.g. rtol=1e-10) for _fit_xxx in PR #2374
ENH/REF: add LikelihoodModel._fit_collinear, adjust _fit_zeros and tests … f3adefc

  • not all models define mle_settings (only those that use scipy optimizers) -> add to all
  • rename ? mle_settings to more general optim_settings, and corresponding mle_retvals
  • optimizer tolerance limits replicability if the fit optimizer settings are not the same
    e.g. I use res.mle_setting['start_params'] to use the same starting values, but not yet the optimizer method, without those the estimated params only agree on a few decimals or rtol

Activity

  1. added this to the 0.10 milestone on Oct 10, 2017
  2. josef-pkt commented on Oct 10, 2017

    @josef-pkt
    MemberAuthor

    duplicate of #479 which mentions also other models (I closed #479 as duplicate)
    I'm running into this again for GLM irls in #4001
    Instead of adding another fit setting keyword to the results instance, it would be better to collect them in optim_settings

    bump for 0.10

    mle_settings is misleading because we have models that are not based on MLE
    optim_settings is a bit misleading in cases where we only solve estimating equations without a direct objective function, e.g. GEE, and some extensions in robust (or even HetGLS which doesn't have an overall objective function either, or other two stage estimation.)
    fit_settings might be misleading because we have other keywords in fit like cov_type
    estim_settings ? (or est_settings ? or estimator_settings because it's only an attribute with access by tab completion)

  3. josef-pkt commented on Oct 10, 2017

    @josef-pkt
    MemberAuthor

    GLM fit_gradient does not add a mle_settings (I thought this is generic)
    mle_retvals attribute is available

    another difference irls uses and adds history attribute which is not available with scipy optimizers
    GLM_fit_gradient adds the number of iterations as only element of history
    e.g. with 'bfgs' I get

    >>> res3.fit_history
    {'iteration': 0}
    
  4. josef-pkt commented on Oct 10, 2017

    @josef-pkt
    MemberAuthor

    RegressionResults doesn't store information about which linalg fit method was used.
    We can infer it from the model attributes created during fit, e.g. pinv_wexog or exog_Q

    information is useful to write unit tests to verify which method has been used.

  5. josef-pkt commented on Oct 10, 2017

    @josef-pkt
    MemberAuthor

    another mle_settings

    cov_params has

    if (hasattr(self, 'mle_settings') and
                    self.mle_settings['optimizer'] in ['l1', 'l1_cvxopt_cp'])
    

    which raises if mle_settings exists but without optimizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions