Skip to content

Ability to specify snapshot matrices, X and X', for DMDc #564

@elise1993

Description

@elise1993

Hello! I want to train a DMDc model, $X' = AX + B\Upsilon$ on data where the snapshots have been shuffled. For example:

$$X = [x_1, x_4, x_6, x_9]$$

and the time-shifted copy:

$$X' = [x_2, x_5, x_7, x_{10}]$$

For regular DMD, this works fine, since the method allows you to explicitly write:

model = DMD().fit(X, Xprime) or model = DMD().fit(X, Y=Xprime)

However for DMDc, I don't know how to train the model on the same shuffled data, given the shuffled input vector:

$$\Upsilon = [u_1, u_4, u_6, u_9]$$

since DMDc only allows the following inputs:

model = DMDc().fit(snapshots, inputs)

Is this not possible with DMDc? Or could this functionality be added? So we could write:

model = DMDc().fit(X, inputs, Y=Xprime)

Thanks!

PS: I made a quick edit to the dmdc.py file at lines 314-317 that seems to fix this, but it may need an adjustment if lag=/=1. It also requires $X, X' \in R^{n,m}$, and $\Upsilon \in R^{l,m}$ to have the same number of snapshots ($m$); whereas by default, $\Upsilon \in R^{l,m-1}$:

    def fit(self, X, I, B=None, Y=None):

...
        if Y is None:
              X = self.snapshots[:, : -self._lag]
              Y = self.snapshots[:, self._lag :]
        else:
            self._compare_data_shapes(Snapshots(Y).snapshots)
            self._snapshots_holder_y = Snapshots(Y)
            X = self.snapshots
            Y = self.snapshots_y

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions