DataDrivenDiffEq.jl
repository·master·Indexed 19 days ago
https://github.com/sciml/datadrivendiffeq.jlA SciML package for structural estimation and identification of differential equations from data, enabling automatic equation discovery. The suite includes specialized components: DataDrivenSparse.jl for sparse regression (SINDy, STLSQ, ADMM), DataDrivenSR.jl for symbolic regression via SymbolicRegression.jl, DataDrivenDMD.jl for Dynamic Mode Decomposition and Koopman-based methods, and DataDrivenLux.jl for deep-learning-based structure search using differentiable directed-acyclic-graph (DAG) models.
What's inside DataDrivenDiffEq.jl
- DataDrivenDiffEq.jl is a package within the SciML ecosystem designed for data-driven differential equation structural estimation and identification. It provides tools to automatically discover governing equations from data and use those discovered equations to simulate perturbed dynamics.
What is DataDrivenSR.jl
masterDataDrivenSR.jl is a package for discovering closed-form governing equations from data using symbolic regression methods. It is built on top ofSymbolicRegression.jl. While it can be used as a standalone package, it is a component of the largerDataDrivenDiffEq.jlmonorepo, which provides a complete suite for data-driven modeling.Overview of DataDrivenLux.jl
masterDataDrivenLux.jl is a deep-learning-based structure search component designed for discovering governing equations. It is built on top of
Lux.jland utilizes differentiable directed-acyclic-graph (DAG) candidate models to perform structure search.While it can be used as a standalone package, it is part of the larger
DataDrivenDiffEq.jlmonorepo. For a complete data-driven modeling suite, users should useDataDrivenDiffEq.jl.Overview of DataDrivenSparse.jl
masterDataDrivenSparse.jl is a specialized component within the DataDrivenDiffEq.jl ecosystem focused on sparse regression methods. It is designed to discover parsimonious governing equations from data using techniques such as SINDy, STLSQ, and ADMM.
While it can be used as a standalone package, it is intended to be part of the broader DataDrivenDiffEq.jl suite for users requiring a complete data-driven modeling workflow.
Overview of DataDrivenDMD.jl
masterDataDrivenDMD.jl is a specialized component within the
DataDrivenDiffEq.jlmonorepo. It focuses on Dynamic Mode Decomposition (DMD) and Koopman-based methods. These methods are used to discover linear operator approximations of dynamical systems directly from data.While
DataDrivenDMD.jlcan be used as a standalone package, it is recommended to use the fullDataDrivenDiffEq.jlsuite if you require a comprehensive collection of data-driven modeling tools.Use DataDrivenSR to infer systems of equations
masterDataDrivenSR provides an API wrapper around
SymbolicRegression.jldesigned to infer arbitrary systems of equations of the form:$$y_{i} = f(x_{i}, p, t_i, u_{i})$$
where $y_i$ is the state, $x_i$ are inputs/features, $p$ are parameters, $t_i$ is time, and $u_i$ are control inputs. It is used for discovering the underlying mathematical structure of dynamical systems from data.
Discover governing equations with DataDrivenLux
masterDataDrivenLux is a component of the DataDrivenDiffEq ecosystem that provides differentiable directed-acyclic-graph (DAG) structure search. It is designed to discover the governing equations of a system by searching through possible graph structures using differentiable methods.Infer systems of equations using DataDrivenSparse
masterDataDrivenSparse is a framework for inferring systems of equations by expressing an unknown function $f$ as a linear combination of basis elements $\varphi_i$. It solves the sparse regression problem to find a sparse coefficient matrix $\Xi$ that minimizes the error between the observed data $Y$ and the basis evaluations $\varPhi$.
For explicit systems of the form $y_{i} = f(x_{i}, p, t_i, u_{i})$, the goal is to solve: $$\Xi' = \min_{\Xi} \lVert\Xi \rVert_0 \text{ s.t. } \Xi \varPhi = Y$$
For implicit systems of the form $f(y_i, x_i, p, t_i, u_i) = 0$, you can use an
ImplicitOptimizerto solve: $$\Xi' = \min_{\Xi} \lVert\Xi \rVert_0 \text{ s.t. } \Xi \varPhi_y = 0$$ where $\varPhi_y$ contains basis functions that may depend on the target variables $y$.!!! warning "Tuning parameters for sparse regression" The algorithms are highly sensitive to hyperparameter tuning. Settings are problem-specific and depend on your data and the underlying equations. For automated hyperparameter optimization, consider using Hyperopt.jl.
Understand Koopman operator-based inference in DataDrivenDMD
masterDataDrivenDMD uses operator-based inference to approximate dynamical systems. It assumes that a discrete dynamical system $x_{i+1} = f(x_{i}, p, t, u_{i})$ can be represented in a higher-dimensional observable space $\varphi$ where the evolution is linear: $\varphi_{i+1} = \mathcal K \circ \varphi_i$.
Because the true Koopman operator $\mathcal K$ may exist in infinite dimensions, DataDrivenDMD uses Dynamic Mode Decomposition (DMD) to find a finite-dimensional matrix approximation $K$ such that $\hat \varphi_{i+1} \approx K \hat \varphi_i$. For continuous-time systems, it approximates the Koopman generator $K_G$ such that $\partial_t \hat \varphi \approx K_G \hat \varphi$.
Configure common options for DataDrivenDiffEq solvers
masterMany algorithms in
DataDrivenDiffEqshare a set of configuration parameters collected in theDataDrivenCommonOptionsstruct. These can be passed to thesolvefunction via theoptionskeyword argument.The
eval_expressionoptionThis keyword controls how functions are created during the inference process:
eval_expression=true: Uses standardeval. This follows normal Julia world-age rules, meaning the generated functions cannot be called from the function that created them.eval_expression=false(Default): UsesGeneralizedGenerated.jlto allow for same-world-age evaluation. Warning: This can cause Julia to segfault if the basis functions are sufficiently large.
Model Selection via the
selectoroptionTo handle hyperparameters (like sparsity penalties or train-test splits), you can pass a
selectortoDataDrivenCommonOptions. The solver will return the model that minimizes this selector.Common built-in selectors include:
rss(Residual Sum of Squares)bic(Bayesian Information Criterion)aic(Akaike Information Criterion)aicc(Corrected Akaike Information Criterion)r2(R-squared)
Since subresults extend the
StatsBaseAPI, you can also provide a custom function as a selector.# Example: Using a custom selector for Mean Squared Error options = DataDrivenCommonOptions(selector = (x) -> rss(x) / nobs(x)) res = solve(problem, basis, STLSQ(); options = options)Process and normalize data for differential equation discovery
masterThe package provides utilities for preparing datasets before they are used in discovery algorithms.
DataProcessing: Provides tools for general data manipulation and preparation.DataNormalization: Specifically handles the scaling and normalization of data to ensure numerical stability and consistent feature importance during the discovery process.
Use DataDrivenSolution to manage discovery workflows
masterTheDataDrivenSolutionobject is the primary container for managing the lifecycle of a data-driven differential equation discovery task. It encapsulates the problem definition, the basis used for discovery, the algorithm applied, and the resulting discovered model. Use it to track whether a discovery process has successfully converged via its return codes.