Open LeZhengThu opened 3 years ago
Hi @LeZhengThu
The stride is an additional parameter for decomposing the total time-series of a training example into a smaller chunks for learning. Specifically, the stride is the index we sample these smaller time-series at and more importantly is the number of input time-steps to the model. This contrasts to target_steps which specifies the length of these smaller time-series.
For example consider a time series of 30 time-steps and I set up a data-loader with stride = 5, target_steps = 10, the target examples would look like:
while the inputs to the model would be:
The reason I did this augmentation to the data is I found this deep Koopman to be very unstable during training, requiring smaller time-series lengths to get more consistent convergence. Similarly having a small history as inputs increased stability as well.
Hope this clears things up.
@NickGeneva Thanks for the reply. As in your example, do you mean that t is 5 and t+1 is 10 when you compute the loss function in your blog?
@NickGeneva I set stride to 1 and can get pretty good prediction results given the test data. Then I'd like to test a randomly chosen new initial point. Below is my code. model is the Koopman network I trained. X is the trajectory of the new initial point, and Xk is the estimated trajectory given the initial point and the Koopman network. gg is the internal evolution of the observable.
X = odeint(deriv, [x0, v0], np.arrange(0, tmax, dt))
Xk = np.zeros(X.shape)
xx = torch.Tensor([x0, v0]).to(model.device).unsqueeze(0)
gg = model.observableNet(xx)
Xk[0, :] = model.recoverNet(gg).detach().cpu().numpy()
for i in range(X.shape[0]):
gg = model.koopmanOperation(gg)
Xk[i, :] = model.recoverNet(gg).detach().cpu().numpy()
However, I get very bad results. I wonder if I'm misunderstanding the function of model.koopmanOperation.
Hi Nick, what's the meaning of parameter stride in the dataLoader function?