Skip to content

Class factory for NegativeBinomial #842

Open

Description

@jseabold

This will also apply to Tobit (and maybe ARIMA). I'm starting to like more that most options go into the Model instantiation and the fit methods are as uniform as possible. Could possible help in writing Pipeline-style code for bootstrapping etc. like scikit-learn, though I need to think more about whether and how it generalizes. Something like

class _NegativeBinomialBase(LikelihoodModel):
    ...

class NegativeBinomialNB1(_NegativeBinomialBase):
    def loglike(self, params):
        ...

...

def NegativeBinomial(..., loglike_method="nb1"):
    if loglike_method == "nb1":
        return NegativeBinomialNB1(...)

Activity

  1. josef-pkt commented on May 19, 2013

    @josef-pkt
    Member

    Ok, something like this sounds simple enough. I thought about doing something like this before.

    The only place I know where similar dispatch to subclasses occurs is in the scipy spline classes, and there I found it confusing when there are different methods and options.
    But in our cases it might be understandable enough.

    BTW: I created a linmod function once, that dispatched to OLS, WLS or GLS depending on the presence of keywords, weights and sigma.

    I thought initially that you meant creating classes on the fly.

  2. jseabold commented on May 19, 2013

    @jseabold
    MemberAuthor

    Nah, I don't think we would gain much from having any black magic here. Literally the only methods I can think to overwrite would be the loglike and hessian. Something like a linmod or LinearModel might be a nice entry-point too.

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