Skip to content

FAQ-D/SUMM: Miscmodels status? #3738

Closed
Closed

Description

@jbrockmendel

miscmodels appears to have more rough edges than the rest of the non-sandbox code. A number of the models there look built for demonstration purposes more than anything else. Is this perception correct? Is there a gameplan for main-lining it?

Activity

  1. josef-pkt commented on Jun 2, 2017

    @josef-pkt
    Member

    One of the GSOC projects is implementing extensions to count models including ZeroInflatedPoisson and similar. This will make the corresponding miscmodels obsolete.

    However, besides providing models, the miscmodels provide the test and example cases for GenericLikelihoodModel.
    The "providing models" part was intended for quickly adding new models without having to code all the details and extensions. But I think they are not used much in the wild, and are not much advertised. Properly enhanced models should find their way into a location appropriate for the model. But we still need test and demonstration cases for GenericLikelihoodModel.

    GenericLikelihoodModel and miscmodels was also a bit of an experimentation playground, e.g. it can also use nonlinear constraints and simple bootstrap standard errors, which we don't have in other models yet.

    GenericLikelihoodModel is supposed to be our convenience model for users for how to make a MLE model in 5 (or 30) minutes.

  2. jbrockmendel commented on Jun 3, 2017

    @jbrockmendel
    ContributorAuthor

    This is helpful also for clarifying the role of GenericLikelihoodModel, thanks.

    One of the GSOC projects is implementing extensions to count models including ZeroInflatedPoisson and similar. This will make the corresponding miscmodels obsolete.

    I've been following that PR, looking forward to seeing it.

    There are a bunch of places (not just in miscmodels) with double-comments at the beginning of lines. Do these hold some significance or reflect some convention? They prevent code-folding in SublimeText, so I always feel the urge to indent them.

  3. jbrockmendel commented on Jun 3, 2017

    @jbrockmendel
    ContributorAuthor

    Take for example miscmodels.nonlinls.NonlinearLS.fit. It's signature is def fit(self, start_value=None, nparams=None, **kw). If this were written today it would probably have start_params instead of start_value. Is this accurate, and if so, is deprecating the non-conforming arg worthwhile?

  4. josef-pkt commented on Jun 3, 2017

    @josef-pkt
    Member

    The double comments are the behavior of IDLE and don't have a deeper meaning. They can be replaced with single comments for cleanup if it's relevant.

    NonlinearLS is a good example for "sandbox-style" code, written at some point when nothing related existed, and API choices were stillopen, it has been rewritten in a PR (a half GSOC project), scipy in the meantime has improved a lot with related optimizers.
    Like in a junk yard, try to grab and recycle all the necessary pieces and build a new car. Washing a half finished car might not be very useful if we want to have one functioning version instead of 3 partial versions.
    A unit tested 80% finished model would be usable, even if it's missing the seat belt, airbag and air conditioning.

    Essentially, I have put low priority on nonlinear LS because it's well covered by the lmfit package and for simple usage by scipy. AFAIR, I ignored NonlinearLS in my last round of GenericLikelihoodModel/miscmodel refactorings, enhancements and unit testing.

  5. jbrockmendel commented on Jun 3, 2017

    @jbrockmendel
    ContributorAuthor

    Makes sense. At some point I may agitate to move that back to the sandbox, but that's for another day.

    Last GenericLikelihoodResults question for the time being: why are we passing mlefit as an argument instead of just calling super(...).__init__? The self.__dict__.update(mlefit.__dict__) at the end of __init__ makes puppies cry.

  6. josef-pkt commented on Jun 3, 2017

    @josef-pkt
    Member

    why are we passing mlefit as an argument instead of just calling super(...).__init__?

    I think I took the pattern from DiscreteResults. I don't remember the details, this was designed during the first GSOC.
    IIRC, we use mlefit as argument because the super(...).fit() call in the subclass fit already returns a results instance and we just need to move things over to the instance of the model specific results class.
    (I don't remember this giving us any problems, so I didn't have to look at it and think about it much in the last 8 or so years).
    The location of self.__dict__.update(mlefit.__dict__) in the sequence inside __init__ is important to override attributes that the provided mlefit instance already has. But I don't remember any specific cases or problems.

  7. jbrockmendel commented on Jun 3, 2017

    @jbrockmendel
    ContributorAuthor

    That explains how we got to this point thanks.

    I think there is significant room to clean this up; looks like you had this idea back in #2122 and even implemented something similar to what I have in mind. But instead of accessing results_class inside GenericLikelihoodModel.fit, access it in LikelihoodModel.fit. Then the workaround for GenericLikelihoodResults and DiscreteResults can be made unnecessary.

    This is thematically similar to the idea of passing k_constr to fit suggested in #3735. They both move towards decreasing the amount of Results-construction that is done outside of the XYZ.Results.__init__.

    That said, I don't plan to push for this design change anytime soon. The question posed in this issue has been thoroughly answered. Thanks.

  8. josef-pkt commented on Jun 3, 2017

    @josef-pkt
    Member

    you can leave issues like this open.
    with either SUMM or FAQ-D, and they won't go into our bug count

  9. changed the title [-]Miscmodels status?[/-] [+]FAQ-D/SUMM: Miscmodels status?[/+] on Oct 4, 2017
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions