Git Product home page Git Product logo

Comments (7)

pswpswpsw avatar pswpswpsw commented on July 28, 2024 1

It is because the pykoopman you imported is the one from PyPi, which is a very old version. I just uploaded the 1.0.1 version. You should be able to find the example working now.

from pykoopman.

moonlians avatar moonlians commented on July 28, 2024 1

Thanks! I uninstalled and reinstalled, tried both from git clone and pip install pykoopman.
But it for some reason is not loading correctly:
Traceback (most recent call last):

Cell In[891], line 1
EDMDc = pk.regression.DMDc()

AttributeError: module 'pykoopman' has no attribute 'regression'

I definitely have "regression" folder inside the git cloned folder...

EDIT: it works as from pykoopman.regression import DMDc, so I can do that.

from pykoopman.

pswpswpsw avatar pswpswpsw commented on July 28, 2024 1

please take a look at the cell [5] in https://github.com/dynamicslab/pykoopman/blob/master/docs/tutorial_koopman_hankel_dmdc_for_vdp_system.ipynb

So basically, if you are implementing EDMDc with time delay, set svd_output_rank or svd_rank less than the full rank might lead to worse performance.

In fact, this is not a special case. Here is an example in my JFM paper:

  • Looking at figure 12 in the following paper, when using EDMD with monomials, choosing a svd rank in the least square does not help.

Reference

from pykoopman.

moonlians avatar moonlians commented on July 28, 2024

There seems to also be a problem instituting the SVD rank:

from pykoopman.regression import EDMDc
EDMDc = DMDc(svd_rank=20)

n_delays = 71
obs = TimeDelay(n_delays=n_delays)

model = pk.Koopman(observables=obs, regressor=EDMDc)
model.fit(X1.T, y=X2.T, u=U[:,n_delays:len(X)].T) 

gives the error:

model.fit(X1.T, y=X2.T, u=U[:,n_delays:len(X)].T) 
Traceback (most recent call last):

  Cell In[3541], line 1
    model.fit(X1.T, y=X2.T, u=U[:,n_delays:len(X)].T)

  File ~\anaconda3\envs\DMD\lib\site-packages\pykoopman\koopman.py:170 in fit
    self._pipeline.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\pykoopman\regression\_base_ensemble.py:107 in fit
    self.regressor_.fit(X, y_trans, **fit_params)

  File ~\anaconda3\envs\DMD\lib\site-packages\pykoopman\regression\_dmdc.py:146 in fit
    self._fit_unknown_B(X1, X2, C, r, rout)

  File ~\anaconda3\envs\DMD\lib\site-packages\pykoopman\regression\_dmdc.py:175 in _fit_unknown_B
    assert rout <= r

AssertionError

It works fine when I don't include the svd_rank parameter.

from pykoopman.

pswpswpsw avatar pswpswpsw commented on July 28, 2024

can you have a complete self-contained code here? including the data

from pykoopman.

moonlians avatar moonlians commented on July 28, 2024

Thanks, that's really helpful!

from pykoopman.

moonlians avatar moonlians commented on July 28, 2024

So basically, if you are implementing EDMDc with time delay, set svd_output_rank or svd_rank less than the full rank might lead to worse performance.

It seems like when there is noise in the control signal, it unfortunately leads to overfitting

from pykoopman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.