HW 7: Deep Koopman

due 2/27/2025 before midnight via Learning Suite 25 possible points


We’ll use deep learning to learn a Koopman operator using the methodology of this paper (though we’ll simplify it somewhat for this homework). At a minimum you’ll want to refer to figure 1, the subsection “Deep learning to identify Koopman eigenfunctions” under Results, and the subsection “Explicit loss function” under Methods. We’ll make the following simplifications: we won’t need the auxiliary network to learn eigenvalues, and so won’t need to construct a block diagonal K (this is a nice approach for better accuracy and for explainability of the results, but we won’t worry about it in this case and will just learn the whole matrix K directly). I did not add the infinity norm loss in (15), for eq (13) I used the entire time horizon (so eq (13) and (14) use the same sum across time).

The data comes from glycolysis pathway dynamics. I ran the simulations and pretabulated the data here to save time. The following commands will load the data:

ntraj = 2148  # number of trajectories
nt = 50  # number of time steps
ny = 7  # number of states

tvec = np.linspace(0, 350, nt)
Y = np.loadtxt('kdata.txt').reshape(ntraj, nt, ny)
Ytrain = Y[:2048, :, :]  # 2048 training trajectories
Ytest = Y[2048:, :, :]  # 100 testing trajectoreis

You should be able to find a linear mapping (matrix K) that reasonably reproduces the dynamics in the testing data set. Plot the dynamics for the first trajectory in the dataset against your trained model (data with dashed line, and model solid lines). Only plot the first three states just to keep the plot less busy.

Tips: