Skip to content

S3 Method predict._elnet seems to take priority over predict.model_fit and registered predict modules for glmnet based models #1252

Open
@chillerb

Description

@chillerb

The problem

When registering a custom model which also returns a modified glmnet class object, it took me a while to notice that parsnip also exports the S3 Method predict._elnet. Since _elnet is the first listed class object in the list of class attributes, the method predict._elnet exported by parsnip seems to take priority over parsnip's own predict.model_fit, therefore never actually calling my registered predict module, but parsnips glmnet routine. I know that this must be some super rare edge case, but it just took me an hour to figure this out and it seems like a developer pitfall to be aware of.

class(my_model)
[1] "_elnet"    "model_fit"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions