Skip to content

BUG/REF PHReg.predict returns Bunch #2894

Open

Description

@josef-pkt

PHReg.predict returns a Bunch with predicted and standard errors which breaks writing generic code on top of it
#2884 (comment)

it would also break generic cross validation or similar.

The pattern that we get slowly into is that predict stays just the mean prediction/expected values and a new method get_prediction returns the full prediction results.

One possibility would be to add a new keyword return_se=False which could be reused and wrapped by get_prediction

Activity

  1. kshedden commented on Apr 15, 2016

    @kshedden
    Contributor

    Leland and I are looking at this and will come up with a PR.

    Kerby

    On Fri, Apr 15, 2016 at 12:26 PM, Josef Perktold [email protected]
    wrote:

    PHReg.predict returns a Bunch with predicted and standard errors which
    breaks writing generic code on top of it
    #2884 (comment)
    #2884 (comment)

    it would also break generic cross validation or similar.

    The pattern that we get slowly into is that predict stays just the mean
    prediction/expected values and a new method get_prediction returns the
    full prediction results.

    One possibility would be to add a new keyword return_se=False which could
    be reused and wrapped by get_prediction

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly or view it on GitHub
    #2894

  2. josef-pkt commented on May 3, 2016

    @josef-pkt
    MemberAuthor

    @kshedden @lbybee If you have comments about the current implementation for get_prediction, then I would appreciate those. I have only advertised it reluctantly because I wasn't sure about some of the API and implementation choices.

  3. lbybee commented on May 3, 2016

    @lbybee
    Contributor

    I've gotten something for this together that seems to be working, the only issue right now is that it breaks the MICE tests. @kshedden and I are actually meeting tomorrow and I was planning to submit a PR after we talk.

    Basically the way it is working right now is in line with what you mentioned in the initial comment. I've duplicated a version of _prediction from regression that works for PHReg and have modified the tests to account for both possible versions of the predict. Given that there is some overlap with the code now for get_prediction it might be worth it to put together a more abstract version.

  4. josef-pkt commented on May 3, 2016

    @josef-pkt
    MemberAuthor

    @lbybee thanks for the update.
    IIRC:
    Mice is special casing the predict method of PHReg which won't be needed anymore once predict follows the standard pattern.
    The special casing in base.Results.predict uses an attribute instead of isinstance check which is not directly affected by changes in PHReg predict, but the special casing can be removed when PHReg.predict is standardized.

    About your new get_prediction: Is there just code duplication/overlap, or do you want to change parts of the API to fit your case?

  5. lbybee commented on May 3, 2016

    @lbybee
    Contributor

    Ok, sounds good.

    It isn't a complete duplicate or subset of the other get_prediction, there were some changes that needed to be made to make it play nice with PHReg, but they were fairly small changes.

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