dynamicslab / pykoopman Goto Github PK
View Code? Open in Web Editor NEWA package for computing data-driven approximations to the Koopman operator.
Home Page: https://pykoopman.readthedocs.io
License: MIT License
A package for computing data-driven approximations to the Koopman operator.
Home Page: https://pykoopman.readthedocs.io
License: MIT License
I installed the package using pip, and am trying to run the tutorial_koopman_edmdc example. However, I get error when trying to import as shown below:
ImportError Traceback (most recent call last)
in
1 get_ipython().run_line_magic('matplotlib', 'inline')
2 import pykoopman as pk
----> 3 from pykoopman.common.examples import vdp_osc, rk4, square_wave # required for example system
4 import matplotlib.pyplot as plt
5 import numpy as np
ImportError: cannot import name 'vdp_osc' from 'pykoopman.common.examples' (/Users/jehanzeb/anaconda3/lib/python3.8/site-packages/pykoopman/common/examples.py)
Hi,
I am trying to implement the NNDMD and want to save the learned dlk_regressor for future use. How could I save and load the learned regressors and models (e.g., run with pk.Koopman.fit())?
Thanks in advance for any assistance.
Lu
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.
Line 173 in a3c6f98
the file setup.py
doesn't exist
When using NNDMD, it seems that changing the activation function results in an error. Could this be because the library does not define activation functions other than linear?
I believe that in the HAVOK/Lorenz example, in cell 9 under "Prediction using the HAVOK model", we should be plotting xpred[:,j]
, not xpred[:,i]
. This (very minor) bug doesn't actually show up because it so happens that since INDEX
is [0], [1], [2], or [1,2], we always have i == j
. However, if we were to choose INDEX = [0, 2]
, then the bug would appear.
Hi,
first thank you for the very nice package!
If I understand it correctly, Koopman.simulate
simulates the learned model forward in time with the same time interval dt
as the one which was used to fit the model, right ? If so, would it be possible to include an option to change the dt
for this prediction. For instance, I would like to test the quality of the learning with a small number of snapshots over a given time interval and check against the solution on the intermediate time steps between 2 snapshots used for the training.
Thanks!
Take the _edmd.py in pykoopman.regression as an example. In this file, phi is computed as self._ur.conj().T @ x_col, while psi is computed as self._tmp_compute_psi @ x_col. I can't figure out the true meaning behind the phi and psi, not to mention their difference. Could you please explain it in more detail by Mathematical formula? It would be more appreciated if there are corresponding articles to provide.
Hello,
While running example: tutorial_eigenfunctions_with_EDMD.ipynb, I ran into error in cell 5.
Apparently, in koopman.py, line 562: return self.model.steps[-1][1].kef_
"kef_" was not defined. Also see below. Please help! Thanks!
AttributeError Traceback (most recent call last)
Cell In[5], line 7
4 model.fit(X.T, y=Y.T)
6 print(model.eigenvalues)
----> 7 sys.visualize_modes(X, model.eigenfunctions)
File /pykoopman/koopman.py:562, in Koopman.eigenfunctions(self)
560 check_is_fitted(self, "model")
561 #return self.model.steps[-1][1].eigenfunctions_
--> 562 return self.model.steps[-1][1].kef_
AttributeError: 'EDMD' object has no attribute 'kef_'
Is there a function that can predict the derivative with respect to time of a certain state variable?
I have lightning version 2.0.5 installed. The pykoopman version is 1.0.4.
When I run "dlk_regressor.fit(traj_list)" in the example "tutorial_koopman_nndmd_examples.ipynb".
It shows errors
INFO: GPU available: True (cuda), used: True
[rank_zero.py:48 - _info() ] GPU available: True (cuda), used: True
INFO: TPU available: False, using: 0 TPU cores
[rank_zero.py:48 - _info() ] TPU available: False, using: 0 TPU cores
INFO: IPU available: False, using: 0 IPUs
[rank_zero.py:48 - _info() ] IPU available: False, using: 0 IPUs
INFO: HPU available: False, using: 0 HPUs
[rank_zero.py:48 - _info() ] HPU available: False, using: 0 HPUs
INFO: Initializing distributed: GLOBAL_RANK: 1, MEMBER: 2[/2](https://file+.vscode-resource.vscode-cdn.net/2)
[distributed.py:245 - _init_dist_connection() ] Initializing distributed: GLOBAL_RANK: 1, MEMBER: 2[/2](https://file+.vscode-resource.vscode-cdn.net/2)
INFO: Initializing distributed: GLOBAL_RANK: 0, MEMBER: 1[/2](https://file+.vscode-resource.vscode-cdn.net/2)
[distributed.py:245 - _init_dist_connection() ] Initializing distributed: GLOBAL_RANK: 0, MEMBER: 1[/2](https://file+.vscode-resource.vscode-cdn.net/2)
INFO: ----------------------------------------------------------------------------------------------------
distributed_backend=nccl
All distributed processes registered. Starting with 2 processes
----------------------------------------------------------------------------------------------------
[rank_zero.py:48 - _info() ] ----------------------------------------------------------------------------------------------------
distributed_backend=nccl
All distributed processes registered. Starting with 2 processes
----------------------------------------------------------------------------------------------------
2023-09-14 16:20:30.863437: I tensorflow[/core/platform/cpu_feature_guard.cc:193](https://file+.vscode-resource.vscode-cdn.net/core/platform/cpu_feature_guard.cc:193)] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F AVX512_VNNI FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-09-14 16:20:31.016351: I tensorflow[/core/util/port.cc:104](https://file+.vscode-resource.vscode-cdn.net/core/util/port.cc:104)] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2023-09-14 16:20:32.029631: W tensorflow[/compiler/xla/stream_executor/platform/default/dso_loader.cc:64](https://file+.vscode-resource.vscode-cdn.net/compiler/xla/stream_executor/platform/default/dso_loader.cc:64)] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: [/usr/local/cuda-11.7/lib64](https://file+.vscode-resource.vscode-cdn.net/usr/local/cuda-11.7/lib64)
2023-09-14 16:20:32.029742: W tensorflow[/compiler/xla/stream_executor/platform/default/dso_loader.cc:64](https://file+.vscode-resource.vscode-cdn.net/compiler/xla/stream_executor/platform/default/dso_loader.cc:64)] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: [/usr/local/cuda-11.7/lib64](https://file+.vscode-resource.vscode-cdn.net/usr/local/cuda-11.7/lib64)
2023-09-14 16:20:32.029751: W tensorflow[/compiler/tf2tensorrt/utils/py_utils.cc:38](https://file+.vscode-resource.vscode-cdn.net/compiler/tf2tensorrt/utils/py_utils.cc:38)] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
---------------------------------------------------------------------------
ProcessRaisedException Traceback (most recent call last)
Cell In[6], line 1
----> 1 dlk_regressor.fit(traj_list)
File [~/anaconda3/envs/dpc/lib/python3.10/site-packages/pykoopman/regression/_nndmd.py:1187](https://file+.vscode-resource.vscode-cdn.net/media/lk/lksgcc/lk_git/3_Reinforcement_Learning/3_4_MPC/pykoopman/docs/~/anaconda3/envs/dpc/lib/python3.10/site-packages/pykoopman/regression/_nndmd.py:1187), in NNDMD.fit(self, x, y, dt)
1184 raise ValueError("check `x` and `y` for `self.fit`")
1186 # trainer starts to train
-> 1187 self.trainer.fit(self._regressor, self.dm)
1189 # compute Koopman operator information
1190 self._state_matrix_ = (
1191 self._regressor._koopman_propagator.get_discrete_time_Koopman_Operator()
1192 .detach()
1193 .numpy()
1194 )
File [~/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py:529](https://file+.vscode-resource.vscode-cdn.net/media/lk/lksgcc/lk_git/3_Reinforcement_Learning/3_4_MPC/pykoopman/docs/~/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py:529), in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
527 model = _maybe_unwrap_optimized(model)
528 self.strategy._lightning_module = model
--> 529 call._call_and_handle_interrupt(
530 self, self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
531 )
File [~/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/call.py:41](https://file+.vscode-resource.vscode-cdn.net/media/lk/lksgcc/lk_git/3_Reinforcement_Learning/3_4_MPC/pykoopman/docs/~/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/call.py:41), in _call_and_handle_interrupt(trainer, trainer_fn, *args, **kwargs)
39 try:
40 if trainer.strategy.launcher is not None:
---> 41 return trainer.strategy.launcher.launch(trainer_fn, *args, trainer=trainer, **kwargs)
42 return trainer_fn(*args, **kwargs)
44 except _TunerExitException:
File [~/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/strategies/launchers/multiprocessing.py:124](https://file+.vscode-resource.vscode-cdn.net/media/lk/lksgcc/lk_git/3_Reinforcement_Learning/3_4_MPC/pykoopman/docs/~/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/strategies/launchers/multiprocessing.py:124), in _MultiProcessingLauncher.launch(self, function, trainer, *args, **kwargs)
116 process_context = mp.start_processes(
117 self._wrapping_function,
118 args=process_args,
(...)
121 join=False, # we will join ourselves to get the process references
122 )
123 self.procs = process_context.processes
--> 124 while not process_context.join():
125 pass
127 worker_output = return_queue.get()
File [~/anaconda3/envs/dpc/lib/python3.10/site-packages/torch/multiprocessing/spawn.py:160](https://file+.vscode-resource.vscode-cdn.net/media/lk/lksgcc/lk_git/3_Reinforcement_Learning/3_4_MPC/pykoopman/docs/~/anaconda3/envs/dpc/lib/python3.10/site-packages/torch/multiprocessing/spawn.py:160), in ProcessContext.join(self, timeout)
158 msg = "\n\n-- Process %d terminated with the following error:\n" % error_index
159 msg += original_trace
--> 160 raise ProcessRaisedException(msg, error_index, failed_process.pid)
ProcessRaisedException:
-- Process 1 terminated with the following error:
Traceback (most recent call last):
File "[/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/torch/multiprocessing/spawn.py](https://file+.vscode-resource.vscode-cdn.net/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/torch/multiprocessing/spawn.py)", line 69, in _wrap
fn(i, *args)
File "[/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/strategies/launchers/multiprocessing.py](https://file+.vscode-resource.vscode-cdn.net/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/strategies/launchers/multiprocessing.py)", line 147, in _wrapping_function
results = function(*args, **kwargs)
File "[/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py](https://file+.vscode-resource.vscode-cdn.net/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py)", line 568, in _fit_impl
self._run(model, ckpt_path=ckpt_path)
File "[/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py](https://file+.vscode-resource.vscode-cdn.net/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/trainer.py)", line 934, in _run
call._call_setup_hook(self) # allow user to setup lightning_module in accelerator environment
File "[/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/call.py](https://file+.vscode-resource.vscode-cdn.net/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/call.py)", line 83, in _call_setup_hook
_call_lightning_datamodule_hook(trainer, "setup", stage=fn)
File "[/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/call.py](https://file+.vscode-resource.vscode-cdn.net/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/lightning/pytorch/trainer/call.py)", line 164, in _call_lightning_datamodule_hook
return fn(*args, **kwargs)
File "[/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/pykoopman/regression/_nndmd.py](https://file+.vscode-resource.vscode-cdn.net/home/lk/anaconda3/envs/dpc/lib/python3.10/site-packages/pykoopman/regression/_nndmd.py)", line 902, in setup
self._tr_x, self._tr_yseq, self._tr_ys, self.normalization
AttributeError: 'SeqDataModule' object has no attribute '_tr_x'
Anyone can help ?
Line 2 in a3c6f98
tutorial_koopman_hankel_dmdc_for_vdp_system.ipynb
%matplotlib inline
import pykoopman as pk
from pykoopman.common.examples import vdp_osc, rk4, square_wave # required for example system
import matplotlib.pyplot as plt
import numpy as np
import numpy.random as rnd
np.random.seed(42) # for reproducibility
import warnings
warnings.filterwarnings('ignore')
n_states = 2 # Number of states
n_inputs = 1 # Number of control inputs
dT = 0.01 # Timestep
n_traj = 200 # Number of trajectories
n_int = 1000 # Integration length
# Time vector
t = np.arange(0, n_int*dT, dT)
# Uniform random distributed forcing in [-1, 1]
u = 2*rnd.random([n_int, n_traj])-1
# Uniform distribution of initial conditions
x = 2*rnd.random([n_states, n_traj])-1
# Init
X = np.zeros((n_states, n_int*n_traj))
Y = np.zeros((n_states, n_int*n_traj))
U = np.zeros((n_inputs, n_int*n_traj))
# Integrate
for step in range(n_int):
y = rk4(0, x, u[step, :], dT, vdp_osc)
X[:, (step)*n_traj:(step+1)*n_traj] = x
Y[:, (step)*n_traj:(step+1)*n_traj] = y
U[:, (step)*n_traj:(step+1)*n_traj] = u[step, :]
x = y
# Visualize first 100 steps of the training data
fig, axs = plt.subplots(1, 1, tight_layout=True, figsize=(12, 4))
for traj_idx in range(n_traj):
x = X[:, traj_idx::n_traj]
axs.plot(t[0:100], x[1, 0:100], 'k')
axs.set(
ylabel=r'$x_2$',
xlabel=r'$t$')
EDMDc = pk.regression.DMDc()
n_delays = 9
obs = pk.observables.TimeDelay(n_delays=n_delays)
model = pk.Koopman(observables=obs, regressor=EDMDc)
model.fit(X.T, y=Y.T, u=U[:,n_delays:].T)
Traceback (most recent call last):
Cell In[291], line 53
model.fit(X.T, y=Y.T, u=U[:,n_delays:].T)
File ~\anaconda3\envs\DMD\lib\site-packages\pykoopman\koopman.py:153 in fit
self.model.fit(x, y, regressor__u=u, regressor__dt=dt)
File ~\anaconda3\envs\DMD\lib\site-packages\sklearn\pipeline.py:394 in fit
self._final_estimator.fit(Xt, y, **fit_params_last_step)
File ~\anaconda3\envs\DMD\lib\site-packages\sklearn\compose\_target.py:229 in fit
self._fit_transformer(y_2d)
File ~\anaconda3\envs\DMD\lib\site-packages\sklearn\compose\_target.py:175 in _fit_transformer
self.transformer_.fit(y)
File ~\anaconda3\envs\DMD\lib\site-packages\sklearn\preprocessing\_function_transformer.py:165 in fit
self._check_inverse_transform(X)
File ~\anaconda3\envs\DMD\lib\site-packages\sklearn\preprocessing\_function_transformer.py:136 in _check_inverse_transform
if not _allclose_dense_sparse(X[idx_selected], X_round_trip):
File ~\anaconda3\envs\DMD\lib\site-packages\sklearn\utils\validation.py:1607 in _allclose_dense_sparse
return np.allclose(x, y, rtol=rtol, atol=atol)
File <__array_function__ internals>:180 in allclose
File ~\anaconda3\envs\DMD\lib\site-packages\numpy\core\numeric.py:2265 in allclose
res = all(isclose(a, b, rtol=rtol, atol=atol, equal_nan=equal_nan))
File <__array_function__ internals>:180 in isclose
File ~\anaconda3\envs\DMD\lib\site-packages\numpy\core\numeric.py:2375 in isclose
return within_tol(x, y, atol, rtol)
File ~\anaconda3\envs\DMD\lib\site-packages\numpy\core\numeric.py:2356 in within_tol
return less_equal(abs(x-y), atol + rtol * abs(y))
ValueError: operands could not be broadcast together with shapes (100,2) (91,2)
I tried also normal EDMD with time delay as an observable and it errored with the same message.
EDMD = pk.regression.EDMD()
model = pk.Koopman(observables=obs, regressor=EDMD)
model.fit(X.T, y=Y.T)
After installing pykoopman, I ran the corresponding program (import pykoopman as pk in Python 3.10.9) and found the following problem:
ModuleNotFoundError: No module named 'optht'
pykoopman/pykoopman/regression/_nndmd.py
Line 10 in a3c6f98
Hi thank you for making this awesome package,
I understand that several works have noted that the L2 norm may not be the best choice for fitting certain functional spaces. Personally, I have an application where the maximum error (Linf) is more important than the mean error (L2). One may also want a sparse fit in some cases too or a lasso regression. Would you consider adding minimization (via linear programming) over other norms as a possibility?
I see this package currently is using pinv and avoiding optimization, but perhaps code from pysindy might make this feasible?
Currently non-identity observables have problems handling one-dimensional input vectors. validate_input
reshapes them into (n,1)
arrays, but this isn't always the desired behavior: sometimes the array elements are different features rather than different samples, in which case the array should have shape (1,n)
. Usually you can fix this by just reshaping your array to be (1,n)
to begin with -- except when running running simulate
in koopman.py
. Even if the x0
you input has shape (1,n)
, the first call to predict
will work as expected, but subsequent iterations will take one-dimensional slices of the array y
, which are then reshaped to (n,1)
arrays by validate_input
leading to errors.
My current "fix" is to simply replace the line y[k + 1] = self.predict(y[k])
in simulate
with y[k + 1] = self.predict(y[k].reshape(1, -1))
. This passes the unit tests and seems to allow predict
to work for non-identity observables, but I don't understand this code nearly well enough to say whether this is the right way to fix this or if this will cause other issues. (I think a similar fix works for when u
is not None
: y[k + 1] = self.predict(y[k].reshape(1,-1), u[k + 1].reshape(1,-1))
, but I'm even less confident here.) It might also be better to do the reshaping in some other part of the code rather than here. Different parts of the code seem to depend on various things being specific shapes in ways that I don't understand, so it's entirely possible that this will cause problems elsewhere.
I hope this helps!
after running pip install .
the dependencies mentionend in the requirements.txt
are not installed
In the tutorial “Dynamic mode decomposition with control (DMDc) for a 128D system”,when i run the :
DMDc = pk.regression.DMDc(svd_rank=11, svd_output_rank=10)
model = pk.Koopman(regressor=DMDc)
model.fit(torus.X.T, u=U[:,np.newaxis], dt=dt)
Phi_dmdc = model.V
torus.viz_all_modes(np.real(Phi_dmdc[:,::2]))
The program will report an error, displaying the error of “AttributeError: 'Koopman' object has no attribute 'V'”.
Fresh env. Tried both pypi and source installation: Got the following error:
Collecting scikit-learn<=1.1.3,>=1.1.3 (from pykoopman==1.0.8)
Using cached scikit-learn-1.1.3.tar.gz (7.0 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Traceback (most recent call last):
File "anaconda3/envs/koopman/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "anaconda3/envs/koopman/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "anaconda3/envs/koopman/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
^^^^^^^^^^^^^^^^
File "anaconda3/envs/koopman/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "anaconda3/envs/koopman/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 994, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/private/var/folders/1h/vpctqsm57x32h6_lcv8v2c0c0000gn/T/pip-build-env-rmmozt_b/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/private/var/folders/1h/vpctqsm57x32h6_lcv8v2c0c0000gn/T/pip-build-env-rmmozt_b/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/private/var/folders/1h/vpctqsm57x32h6_lcv8v2c0c0000gn/T/pip-build-env-rmmozt_b/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Issue resolved when reverted to python 3.10
I would like to apply PyKoopman to a coupled PDE, let's say:
After discretizing for z and solving this system with some initial values I have the matrices t, z, X, T.
t.shape = (150,)
z.shape = (151,)
X.shape = (150, 151)
T.shape= (150, 151)
In which form can I input X and T into model.fit(x, dt=dt)? Does pyKoopman currently support this?
Could you please inform me if your NNMD code is only suitable for very simple systems? When training with my dataset, I've found the results to be very poor, particularly at the sudden change points of some systems. The performance of the predict function is notably inadequate, as it seems capable only of fitting very smooth curves and struggles with instant transitions. Does this library have such an issue? I hope you can point out the parts of the code related to this problem so that I can modify it more effectively.
I was just experimenting with this package. I realized that the installation doesn't work unless installed in the developer mode.
To be more specific the following command doesn't work:
pk,Koopman()
This is the error message I got:
"pykoopman/observables/_radial_basis_functions.py:259
match self.rbf_type:
^
SyntaxError: invalid syntax"
Please help. Thanks
Hello,
I took a quick look at your library and got surprised that no deepkoopman technique was implemented.
Do you plan to include it in the future ? ( Even if this may lead to include a deep-learning dependency to your project. )
I would be happy to try to submit this feature if you interested to include it.
Best regards
Hello,
I am trying to rerun the tutorial code or get the observables names using the polynomial class but every time I get an error. When trying to obtain the get_features_names it isnt defined in the Base file and for the observable the model.koopman(obs=pk.observable.Polynomial(degree =2) regression= EDMDc()) always gives the error that model is not fitted. The tutorial I am trying to follow is the eigen functions with slow manifold and even running it on my pc doesn't work. Could anyone help me out?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.