Bad `ISINDy` results from trivial linear function.
Hi,
I've had some trouble with ISINDy results that I don't think makes any sense so I created a very small example (y = a*x + b) that "should" work but it turns out that it does not.
using DataDrivenDiffEq, ModelingToolkit
@variables A
x = permutedims(collect(1.:10))
y = 2 .+ 3 .* x
Ψ = ISINDy(x, y, Basis([1, A, A^2], [A]), ADM(1.1e-1))
print_equations(Ψ)
##Basis#1576 : 1 dimensional basis in ["A"]
Parameters : Sym{ModelingToolkit.Parameter{Real},Nothing}[p₁, p₂, p₃, p₄, p₅]
Independent variable: t
Equations
φ₁ = ((-p₂) - (A*p₄) - (p₅*(A^2)))*((p₁ + (A*p₃))^-1)
Should this example not work?
I should add that I'm on v0.5.6
This should work, but I think it is ill-posed for this kind of problem. This is basically a special case of ISINDy -> SINDy.
If you switch ADM into STRRidge like described here, you should get a better result.
A valid case would be something along the lines of yx = 2 .+ 3 . x or y = 2 ./ x .+ 3. since we have an ... mind my wording :) ... more explicit implicit relation here.
The output above tends to come up for illposed regression problems. I'll try to catch this in a warning.
I hope this helped you.
Soory, your right. Due to #201 I have revisited ADM and resolved the error. Should be fine on merge. I also added tests.
Lovely, thank you very much (both for your previous comment and for the fix)!