elise1993 / sysidHAVOK

This is a testbed for system identification and forecasting of dynamical systems using the Hankel Alternative View of Koopman (HAVOK) algorithm and Sparse Identification of Nonlinear Dynamics (SINDy). This code is based on the work by Brunton & Kutz (2022) and Yang et. al. (2022).
MIT License
1 stars 0 forks source link

Closed-loop forecasts diverge (blow up) when a large HAVOK memory (stackmax/rmax) is used #6

Closed elise1993 closed 9 months ago

elise1993 commented 10 months ago

Issue

When a longer memory (as defined by stackmax) is allowed in the HAVOK model, closed-loop forecasts of the system diverge over time.

For reproduction, use the following settings in simulateModel.m:

% nonlinear data
t = linspace(0,10,1000);
x0 = [5, 10, 2]';
[t,x] = generateLorenz(t,x0);

% construct HAVOK model from data
x = x(:,1);
stackmax = 60;
rmax = stackmax;

If stackmax is below 50, the model does not diverge during the specified time.

Screenshot 2023-11-14 151631

Potential solution

This problem may be due to unconserved "energy" in the system model, where energy continuously builds up due to errors in the derivative calculations. To prevent this, more symplectic integrators that bound energy, such as RKF78 scheme may be used.

elise1993 commented 10 months ago

Update:

Other possible solutions:

elise1993 commented 10 months ago

This issue appears to have resolved itself with the latest commits (94e2ef9, d467b8c). Reason unknown.

Untitled [stackmax=750, rmax=750]

The model now performs better on validation with increasing stackmax. I believe this is expected, as the linear HAVOK model, representing an approximated Koopman operator, should converge to the true solution as the dimension increases.

To validate this, we can apply HAVOK to a nonlinear system with a known closed-form linearization (a finite-dimensional Koopman-operator), such as:

image

Speculation: When the closed-form linearization exists, we should not see any improvement with higher HAVOK dimension.

elise1993 commented 10 months ago

This issue was never resolved. The issue persists when the linear HAVOK model is simulated for a long enough period:

image [stackmax=350, rmax=stackmax]

Using a smaller stackmax keeps the model bounded:

image [stackmax=40, rmax=stackmax]

Using a large stackmax but small rmax can also bound the model. This allows the model to capture the overarching trends but with less precision:

image

Perhaps it is possible to regularize the model during construction so that the eigenvalues of the HAVOK matrices remain negative. What impact does this have on performance?