Common methods for numerically approximating derivatives
The function "similar" in basis.jl appears to apply the finite difference method which is appropriate for smooth data. Perhaps there should be an option in "similar" as well as in ModelingToolkit for non-smooth and noisy data like Total variation regularized derivative (see R. Chartrand, Numerical Differentiation of Noisy, Nonsmooth Data, ISRN Applied Mathematics, 2011).
Similar just initializes a new vector of operations which is needed for generating an ODEsystem, since at the moment we do not handle time dependent variables explicitly.
I am planning to implement some features used throughout the papers of Kutz et.al., but my main concern right now is ISInDy and the related ADM method.
You may want to use DataInterpolations.jl for some regression splines which would be a natural way to smooth the data.
https://github.com/adrhill/NoiseRobustDifferentiation.jl
I am a bit confused by all of this. This is why I raised this issue in the first place. The SINDy and other INDies always assume that there can be two types of numerical derivatives: noise free and noisy. In the noisy case, Kutz and Brunton along with all the literature on inverse problems systematically use the Chartrand method of Total Variation, now available in the link above.
My original question was whether the numerical derivative ("similar") of DataDrivenDiffEq was covering all the possible cases of numerical derivatives. In addition, the numerical derivative function should now propose the UDE option along with TV as in the data-discovery of LV example with a small sample of 30 observations.
You're right of course. This issue got a little bit out of hand.
Trying to resolve this :smile: : similar in basis.jl was just used to initialize an empty array ( and is now replaced with zeros(eltype(X), n,m) if I am not mistaken - n being the number of functions in the basis, m the number of measurements in X). So it was not used to generate any kind of derivative, but used to compute the function values of the basis given an array of measurements X.
That said, savitzky_golay , found in utils.jl can be used to estimate derivatives. As well as DataInterpolations or collocation methods from DiffEqFlux. The question is rather should we reexport - or in the case of diffeqflux reimplement to keep the deps and precompile time low - these methods, aiming to provide a full estimation toolkit.