Skip to content

GLM attributes #4016

Closed
Closed

Description

@jbrockmendel

Just based on a "this looks funny" knee-jerk:

        result = fit_elasticnet(self, method=method,
                                alpha=alpha,
                                start_params=start_params,
                                refit=refit,
                                **defaults)

        self.mu = self.predict(result.params)
        self.scale = self.estimate_scale(self.mu)

        return result

Is this supposed to be setting self.mu and self.scale? It seems more appropriate that it would set result.mu and result.scale.

Activity

  1. josef-pkt commented on Oct 12, 2017

    @josef-pkt
    Member

    I just remembered, also partially related to #3840 and some other issues:

    We don't have a clear internal API or pattern to set attributes that in some cases we need as lazy attributes, and sometimes we get them as byproduct of some computation.
    We don't have many cases like that, so it never became high priority enough to figure this out.

    for mu in GLM: #1720 and likely in other issues. Some things are left overs from previous versions, but we didn't investigate whether it is safe to remove.

  2. jbrockmendel commented on Oct 12, 2017

    @jbrockmendel
    ContributorAuthor

    That kind of explains how it got this way, but still leaves open the question of whether mu and scale should be attributes of self or result. self.mu is never used by GLM, seems very much like it should not be a Model attribute. scale is a little more ambiguous.

  3. josef-pkt commented on Oct 12, 2017

    @josef-pkt
    Member

    My only guess is that those two were added to fit_regularized in order to be consistent with fit_irls

    @kshedden ?

  4. jbrockmendel commented on Oct 12, 2017

    @jbrockmendel
    ContributorAuthor

    Looks like this has been an issue in the past: #2399

    No tests break if I comment those lines out. in fit it sets self.scale and subsequently passes self.scale to the results constructor. Just changing self.scale-->scale there works fine.

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