Skip to content

check for valid misspelled keywords in models #2163

Open

Description

@josef-pkt

Do we have a mechanism to warn the user that an argument passed to a model was not used?

A misspelled (nonexistent) argument simply disappears into *kwargs.

It is not easy to do automatically because we use **kwargs for cases when different classes handle parts of the keywords, eg. optional or required arrays in sub classes and missing and similar data handling in base classes. Additionally, we have the generic from_formula which has a different signature and keywords than __init__.

I guess the easiest will be to attach valid_kwds to a class, so we can check generically. We already added init_keys to be able to recreate a model which can be reused.

related: some other functions/methods also don't have a check for misspelled keywords. e.g cov_kwds in fit, plotting options ?

Activity

  1. josef-pkt commented on Apr 18, 2017

    @josef-pkt
    MemberAuthor

    example for fit: I didn't remember which tol keyword 'bfgs' uses, fit just ignores incorrect keywords

    related: #3605 opposite case, explicit white list may be incorrect with new extensions

  2. josef-pkt commented on Apr 18, 2017

    @josef-pkt
    MemberAuthor

    this would be another argument for optim_kwds which are all handed off to the optimizer which should raise if unknown keywords have been added.

  3. jbrockmendel commented on Sep 2, 2018

    @jbrockmendel
    Contributor

    +1. This is my main objection to the pattern of having **kwargs all over.

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