SciML / DataDrivenDiffEq.jl

Data driven modeling and automated discovery of dynamical systems for the SciML Scientific Machine Learning organization
https://docs.sciml.ai/DataDrivenDiffEq/stable/
MIT License
402 stars 57 forks source link

DataDrivenProblem takes a very long time #487

Open PaioPaio opened 9 months ago

PaioPaio commented 9 months ago

Hello, I'm trying to run the example of eDMD used on a Nonlinear Time Continuous System, found here https://docs.sciml.ai/DataDrivenDiffEq/stable/libs/datadrivendmd/examples/example_04/#nonlinear_continuos , but the copy-pasteable code now takes about 15 minutes to run. I've tried to run the example on two different computers (one Windows 10, the other Manjaro stable) on VSCode. The code seems to get stuck on the line

prob = DataDrivenProblem(solution)

Since a week ago or so the example worked, I thought that the problem may have been caused by https://github.com/SciML/NonlinearSolve.jl/issues/223 , but this issue seems to be solved and the example still takes a very long time to compute.

P.S. Thank you for the very nice package :)

christianhvejsel commented 7 months ago

Hi @PaioPaio Unfortunately, I am not able to help. I can confirm that DataDrivenProblem/ContinuousDataDrivenProblem takes very long time for the call to DataDrivenProblem and ContinuousDataDrivenProblem effectively making it non-functional on all problems I have tried from the docs: the quick start example: https://docs.sciml.ai/DataDrivenDiffEq/stable/ And all the continuous DMD examples from the docs: https://docs.sciml.ai/DataDrivenDiffEq/stable/libs/datadrivendmd/examples/example_02/ https://docs.sciml.ai/DataDrivenDiffEq/stable/libs/datadrivendmd/examples/example_03/ https://docs.sciml.ai/DataDrivenDiffEq/stable/libs/datadrivendmd/examples/example_04/

versioninfo() Julia Version 1.9.4 Commit 8e5136fa29 (2023-11-14 08:46 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Windows (x86_64-w64-mingw32) CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, tigerlake) Threads: 1 on 8 virtual cores Environment: JULIA_EDITOR = code JULIA_NUM_THREADS =

[b0b7db55] ComponentArrays v0.15.5 [3c9adf31] DataDrivenDMD v0.1.1 [2445eb08] DataDrivenDiffEq v1.3.0 [5b588203] DataDrivenSparse v0.1.2 [0c46a032] DifferentialEquations v7.11.0 [b2108857] Lux v0.5.10 [961ee093] ModelingToolkit v8.73.1 [7f7a1694] Optimization v3.19.3 [36348300] OptimizationOptimJL v0.1.14 [42dfb2eb] OptimizationOptimisers v0.1.6 [1dea7af3] OrdinaryDiffEq v6.59.3 [91a5bcdd] Plots v1.39.0 [c3e4b0f8] Pluto v0.19.32 [7f904dfe] PlutoUI v0.7.54 [1ed8b502] SciMLSensitivity v7.47.0 [860ef19b] StableRNGs v1.0.0 [e88e6eb3] Zygote v0.6.67

christianhvejsel commented 7 months ago

@AlCap23 suggested this workaround adding the Differentials to the call (and not let DataDrivenProblem/ContinuousDataDrivenProblem calculate them).

E.g. for example_02:

X = Array(sol)
t = sol.t
DX = Array(sol(sol.t, Val{1}))
prob = ContinuousDataDrivenProblem(X, t, DX)

The way DX is calculated is from here: https://github.com/SciML/DataDrivenDiffEq.jl/blob/a4471dfafc1adadb79a7c060139915430286f86a/src/problem/type.jl#L486