Skip to content

[BUG] Optimizers do not obey fit_intercept = False, or arg is ambiguous #338

@Jacob-Stevens-Haas

Description

@Jacob-Stevens-Haas

Problem

See coefficient plots in example notebooks 1 and 5, which both show the coefficient matrix $\xi$, fit to an equation of the form:

$$ \begin{align*} \dot x = \xi_0 + \xi_1f_1(x) + \dots + \xi_n f_n(x) \end{align*} $$

Expected vs Actual

As I understood it, if fit_intercept=False (default) $\xi_0$ should always be zero. But it clearly isn't in those examples.

T/S

the fit_intercept parameter is used to calculate offsets in BaseOptimizer.fit(). Those results are used later in the function to explicitly self._set_intercept(). Might also be some interaction with normalize_columns.

Nevermind, this is because even if optimizer fit_intercept is false, PolynomialLibrary defaults to providing a zeroeth order term unless include_bias is false (true by default). WeakPDELibrary and SINDyPILibrary also has an inclue_bias term because they're doing more than just evaluating functions, but maybe that's another piece of evidence that they should be subclasses of SINDy, not BaseFeatureLibrary.

It's also unclear how these options interact - i.e. if both are true, does the model try to fit two intercepts? I'm planting a flag that we ought to remove one or both of these options as part of the breaking changes I discussed last week, slightly biased towards removing include_bias.

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