Skip to content

Promoting Weak, PI, and Trapping to SINDy subclass #351

@Jacob-Stevens-Haas

Description

@Jacob-Stevens-Haas

@akaptano , @znicolaou

When I proposed to combine the derivative and sparse regression step into a single optimization problem, it was clear that I couldn't use the existing SINDy class without some weird hacks (i.e. creating a SingleStepOptimizer that omitted $\dot x$ from the differentiation, expanded the optimization variable to $x$ and $\dot x$, modified the feature library to create identity features for all $x$ and $\dot x$ fields, etc). This reminded me of a lot of what appear, to me, to be idiosyncracies and hacks in the SINDy code:

  • All the feature libraries that re-implement custom functions a la [BUG] Can we remove support for PDELibrary with no spatial derivatives or grid? #192
  • The churn around SINDyPIOptimizer and SINDyPILibrary
  • The weirdness of indirecting the differentiation library in a call to FeatureLibrary.calc_trajectory
  • The danger of using a TensoredLibrary or GeneralizedLibrary with a WeakLibrary and the isinstance() hacks to detect this.
  • The inability to use other sparse optimizers for a trapping problem
  • General questions about which other problem setup choices are mathematically compatible with Trapping
  • The legacy of letting feature libraries do their own ensembling

It became clear to me that if I made SingleStepSINDy a subclass of SINDy, I could do things much more clearly. By not taking a differentiation method, I would prevent users from thinking it made a difference. I could accept any existing Feature Library (other than weak features). And I could add a virtual base class for the optimizers that were compatible with my method (that only applied sparsity to a subset of the optimization variable, when I build this).

And so I ask - are weak, parallel, and trapping problems truly a question of feature library/optimizer (and therefore compatible with other choices of differentiation method/feature library/optimizer) or are they mutually incompatible problem setups? If the latter, I think it makes a lot more sense to promote them to sublcasses of SINDy. This would allow them to keep their own logic, but probably reduce the SLOCs that you exclusively manage and perhaps the multiplicity of tests.

I'm not as familiar with these methods, and knowing how to PR these would involve a more deep reading and understanding the papers and the code (except for PI, which is pretty straightforward). But removing ensembling from the SINDy class (among other things) was the first step, and #319 and #338 would also slim down the SINDy class substantially, making subclassing easier.

Thoughts?

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