pysindy icon indicating copy to clipboard operation
pysindy copied to clipboard

Add differentiation_method to PDELibrary and WeakPDELibrary

Open znicolaou opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

The current PDELibrary and WeakPDELibrary use FiniteDifference to calculate spatial derivatives, and take periodic and is_uniform options. This is an unnecessary limitation on the form of spatial derivatives use to calculate the library terms.

Describe the solution you'd like

We should add an optional differentiation_method argument to the library classes, along with an optional diff_kwargs to supply options like periodic and is_uniform as dictionary elements.

Additional context

This is a simple fix, but I am deferring now so that we can complete #185

znicolaou avatar Jul 01 '22 05:07 znicolaou

One thing that may shouldn't conflict but which comes close is #182. I have a branch implementing that where all differentation types store x as self.smoothed_x_. SmoothedFiniteDifference and SINDyDerivative actually do smooth x and save that instead. This design maintains backwards compatability of _differentiate, so it shouldn't conflict. feature_library.calc_trajectory accesses diff_method.smoothed_x_ to return both x_est, x_dot_est.

Thought they wouldn't conflict in code, there may be a conflict mathematically since model.fit could have already smoothed x before passing it to the feature library. If the feature library uses a differentiation method that also smooths x, it would end up applying the smoother twice.

Jacob-Stevens-Haas avatar Jul 01 '22 18:07 Jacob-Stevens-Haas