EthanJamesLew / AutoKoopman

AutoKoopman - automated Koopman operator methods for data-driven dynamical systems analysis and control.
GNU General Public License v3.0
53 stars 10 forks source link

Error when running Robot benchmark with Koopman #27

Closed Abdu-Hekal closed 1 year ago

Abdu-Hekal commented 1 year ago

@KochdumperNiklas I get this error when running the robot benchmark (for any observable type) Error trace: Tuning GridSearchTuner: 0%| | 0/5 [00:00<?, ?it/s]/Users/b6062805/Documents/Koopman/AutoKoopman/autokoopman/core/tuner.py:149: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray. Error: operands could not be broadcast together with shapes (20,) (88,) end_errors = np.array([s.states.flatten() for s in errors]) Tuning GridSearchTuner: 0%| | 0/5 [00:00<?, ?it/s] Traceback (most recent call last): File "AutoKoopman/notebooks/realDataAll.py", line 175, in perc_error, mse = compute_error(model, test_data) File "AutoKoopman/notebooks/realDataAll.py", line 103, in compute_error trajectory = model.solve_ivp( File "AutoKoopman/autokoopman/core/system.py", line 258, in solve_ivp states = np.zeros((len(times), len(self.names))) TypeError: object of type 'NoneType' has no len()

TUMcps commented 1 year ago

The error arises since the trajectories for the Robot benchmark have different length. I pushed a fix in commit a4090fa876aa9993a07b2c7eafaff80f6814968a to the benchmark branch. Maybe @EthanJamesLew can take a look if the fix is correct and overtake it into the main branch if it is

EthanJamesLew commented 1 year ago

@TUMcps that looks good. cherry-picked! I kept it 2D for reasons I don't understand. I should also add a test for differently sized trajs to test for cases like this in the future.