andreikitaitsev / SymINDy

Symbolic Identification of Non-linear Dynamics. The method generalizes the SINDy algorithm by combining sparse and genetic-programming-based symbolic regression.
MIT License
72 stars 6 forks source link

Can I feed in Raw Data to SINDy? (Unknown equations and derivative values) #30

Open wangsy15 opened 1 year ago

wangsy15 commented 1 year ago

Instead of feeding in equations, can I feed in a set of raw data to pysindy so it can return estimate equations to me? I tested the following system:

d(x0) / dt = 5.56x0 - 3.26x1 + 100np.sin(x0) d(x1) / dt = 3.58x0+2.41x1+10.963

The command used is

symindy = SymINDy(sparsity_coef=1.0, library_name="generalized", dims=2)
symindy.fit(input, time_rec_obs=time)

and i can't obtain appropriate results. The output results do not include sin and constants. May I ask why this is? How should I adjust? image

Looking forward to your reply, thank you!

andreikitaitsev commented 1 year ago

@wangsy15, many thanks for the interest in the package and the question. You shall be able to input the raw data, but then the sparsity coefficient shall be adjusted. Also, the specification of time array improves the results. Unfortunately, I cannot tell with certainly why are you getting exactly these equations since the solution is not unique and depends on the hyperparameters and the sampling rate of the system.

wangsy15 commented 1 year ago

@andreikitaitsev, Thank you very much for your reply. This is a great job! I am currently trying to apply it to practical work. May I ask which of the input parameters are important and can easily affect the results (such as ntrees and sparsity_coef)?