Skip to content

Commit 889d230

Browse files
authored
Fix/reorganize feature library (#74)
* Update ode_utils.py * Update ode_solver.py rk4 revised and __main__ added * Delete ngclearn/utils/diffeq/ode_functions.py * Create odes.py odes name and structure changed * Update __init__.py * Create feature_library.py * Create __init__.py * Create base.py * Delete docs/museum/pc-sindy.md * Create m.md * Add files via upload * Delete docs/images/museum/sindy/m.md * Add files via upload * Create sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * Update sindy.md * fix: correct feature library path and directory name * Delete ngclearn/utils/dymbolic_dictionary directory
1 parent 7510bb3 commit 889d230

File tree

14 files changed

+430
-93
lines changed

14 files changed

+430
-93
lines changed
47.2 KB
Loading
74.2 KB
Loading
78.5 KB
Loading
92.1 KB
Loading
49.6 KB
Loading

docs/images/museum/sindy/sindy.png

153 KB
Loading

docs/museum/pc-sindy.md

Lines changed: 0 additions & 34 deletions
This file was deleted.

docs/museum/sindy.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Sparse Identification of Non-linear Dynamical Systems (SINDy)[1]
2+
3+
In this section, we teach, create, simulate, and visualize SINDy model implemented in NGC-Learn library. After going through this demonstration, you will:
4+
5+
1. Learn how to build a SINDy model of time-series dataset, generated using Ordinary Differential Equations (ODE) of known dynamical systems used in [1].
6+
2. Learn how to build polynomial libraries of given dataset with arbitrary order.
7+
3. Learn how to solve the sparse regression problem by iteratively performing the least squares (LSQ) method followed by thresholding-- Sequential Thresholding Least Square (STLSQ)-- for the given model.
8+
9+
The model **code** for this exhibit can be found [here](https://github.com/NACLab/ngc-museum/exhibits/sindy/sindy.py).
10+
11+
12+
## SINDy
13+
SINDy is a data-driven algorithm that discovers the differential equation governing the dynamical systems. It uses symbolic regression to identify differential equation of the system and it solves sparse regression over the pre-defined library of candidate terms. It takes time series gathered dataset of the system and it gives you its describing differential equation.
14+
15+
16+
<p align="center">
17+
<img src="../images/museum/sindy/sindy.png" width="700">
18+
</p>
19+
20+
21+
22+
23+
### Inputs
24+
> Time: $ts = [t_0, t_1, \dots, T]$
25+
> State matrix: $\mathbf{X}_{(m \times n)}$ (t measurements of n variables)
26+
27+
### Inputs
28+
29+
**Time**
30+
* $ts = [t_0,~t_1, \dots,~T]$
31+
32+
**State matrix**
33+
* $\mathbf{X}(t)_{(m \times n)} = [x(t),~~y(t),~~z(t)]$
34+
35+
36+
37+
38+
39+
Given a set of time-series measurements of a dynamical system state variables ($\mathbf{X}_{(m \times n)}$) we construct:
40+
41+
42+
43+
44+
45+
46+
### Data Matrix
47+
48+
Given a set of time-series measurements of a dynamical system state variables ($\mathbf{X}_{(m \times n)}$) we construct:
49+
Derivative matrix: $\dot{\mathbf{X}}_{(m \times n)}$ (computed numerically)
50+
51+
Library of Candidate Functions: $\Theta(\mathbf{X}) = [\mathbf{1} \quad \mathbf{X} \quad \mathbf{X}^2 \quad \mathbf{X}^3 \quad \sin(\mathbf{X}) \quad \cos(\mathbf{X}) \quad ...]$
52+
53+
------------------
54+
55+
56+
<p align="center">
57+
<img src="../images/museum/sindy/lorenz.png" width="300">
58+
<img src="../images/museum/sindy/oscillator.png" width="300">
59+
</p>
60+
61+
<p align="center">
62+
<img src="../images/museum/sindy/linear_2D.png" width="300">
63+
<img src="../images/museum/sindy/cubic_2D.png" width="300">
64+
<img src="../images/museum/sindy/linear_3D.png" width="300">
65+
</p>
66+
67+
68+
69+
70+
71+
72+
SINDy describes the derivative (linear operation acting on △t) as linear transformations
73+
of a manually constructed dictionary from the state vector by a coefficient matrix.
74+
Dictionary learning combined with LASSO (L1-norm) promotes the sparsity of the coefficient matrix
75+
which allows only governing terms in the dictionary stay non-zero.
76+
77+
78+
79+
## References
80+
<b>[1]</b> Brunton SL, Proctor JL, Kutz JN. Discovering governing equations from data by sparse identification of nonlinear dynamical systems. Proc Natl Acad Sci U S A. 2016 Apr 12;113(15):3932-7. doi: 10.1073/pnas.1517384113. Epub 2016 Mar 28. PMID: 27035946; PMCID: PMC4839439.
81+
82+

ngclearn/utils/diffeq/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from . import ode_solver
2+
from . import odes
3+
from . import ode_utils

ngclearn/utils/diffeq/ode_functions.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)