You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from pykoopman.regression import EDMD
from sklearn.metrics import mean_absolute_percentage_error
from sklearn.metrics import mean_absolute_error
pred = 4
S = np.array(data)
n_output_vars = S.shape[1] # Get the number of output variables
n_delays = 100
n = 310
regressor = EDMD()
# Loop through each timestep
for timestep in range(n, len(S) - pred):
try:
obs = TimeDelay(n_delays=n_delays)
# Prepare input data for the current timestep
X1 = S[:timestep-1].T
X2 = S[1:timestep].T
model = pk.Koopman(observables=obs, regressor=regressor)
model.fit(X1.T, y=X2.T)
n_steps = timestep - n_delays + pred
x0_td = X1[:,:n_delays+1].T
Xkoop = model.simulate(x0_td, n_steps=n_steps)
Xkoop2 = np.vstack([x0_td, Xkoop]) # add initial condition to simulated data for comparison below
except ValueError as ve:
print("Timestep:", timestep, "X1 shape:", X1.shape)
print(ve)
continue
```
```Timestep: 401 X1 shape: (488, 400)
x has too few rows. To compute time-delay features with delay = 1 and n_delays = 100 x must have at least 101 rows.```
It happens at timestep 301 too.
All other timesteps complete fine.
99 time delays seems fine. Delays >100 error.
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: