Closed Abdu-Hekal closed 1 year ago
Same issue arises when running bayesian optimizer for symbolic data and poly observables are used
@Abdu-Hekal this is not from auto_koopman, but from solve_ivp called in the script directly. See commit 8cfb531
for an error handling line . The model learned can be unstable in some regions, so failing solve_ivp can be expected from a trained model (which may have done well in the test region).
Thanks, I have added it. Interesting that this happens often with the bayesian optimizer and not with grid. may result in better options with grid. I will aim to test both
Error trace:
File "/Users/b6062805/Documents/Koopman/AutoKoopman/benchmarks/realDataAll.py", line 175, in
perc_error, mse = compute_error(model, test_data)
File "/Users/b6062805/Documents/Koopman/AutoKoopman/benchmarks/realDataAll.py", line 103, in compute_error
trajectory = model.solve_ivp(
File "/Users/b6062805/Documents/Koopman/AutoKoopman/autokoopman/core/system.py", line 264, in solve_ivp
states[idx + 1] = self.step(
File "/Users/b6062805/Documents/Koopman/AutoKoopman/autokoopman/core/system.py", line 344, in step
return self._step_func(time, state, sinput)
File "/Users/b6062805/Documents/Koopman/AutoKoopman/autokoopman/estimator/koopman.py", line 78, in step_func
obs = (self.obs(x).flatten())[np.newaxis, :]
File "/Users/b6062805/Documents/Koopman/AutoKoopman/autokoopman/core/observables.py", line 32, in call
return self.obs_fcn(X)
File "/Users/b6062805/Documents/Koopman/AutoKoopman/autokoopman/core/observables.py", line 165, in obs_fcn
return self.poly.transform(np.atleast_2d(X))
File "/usr/local/lib/python3.9/site-packages/sklearn/preprocessing/_polynomial.py", line 369, in transform
X = self._validate_data(
File "/usr/local/lib/python3.9/site-packages/sklearn/base.py", line 566, in _validate_data
X = check_array(X, **check_params)
File "/usr/local/lib/python3.9/site-packages/sklearn/utils/validation.py", line 800, in check_array
_assert_all_finite(array, allow_nan=force_all_finite == "allow-nan")
File "/usr/local/lib/python3.9/site-packages/sklearn/utils/validation.py", line 114, in _assert_all_finite
raise ValueError(
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').
Tuning BayesianOptTuner: 5%|▌ | 10/200 [00:03<00:57, 3.28it/s]
Tuning BayesianOptTuner: 2%|▎ | 5/200 [00:03<02:09, 1.50it/s]