dynamicslab / pykoopman

A package for computing data-driven approximations to the Koopman operator.
https://pykoopman.readthedocs.io
MIT License
312 stars 60 forks source link

changing the activation function #42

Closed Dionysus7777777 closed 8 months ago

Dionysus7777777 commented 9 months ago

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?

pswpswpsw commented 9 months ago

So basically for decoder, you must use linear. Because otherwise the concept of Koopman modes is gone. Since this package is designed only for Koopman operator, not Koopman-inspired etc, we decided to discourage the use of nonlinear decoder.

Dionysus7777777 commented 8 months ago

So in Koopman theory, do all activation functions of neural networks have to be linear? In my previous understanding, only the Koopman operator layer needs to be linear; the activation functions of the encoder and decoder do not necessarily need to be linear.

pswpswpsw commented 8 months ago

So in Koopman theory, do all activation functions of neural networks have to be linear? In my previous understanding, only the Koopman operator layer needs to be linear; the activation functions of the encoder and decoder do not necessarily need to be linear.

Koopman theory has nothing to do with neural network. But the entire idea of Koopman modes are only for the observables that can be spanned (i.e., linear weighted sum) by eigenfunctions. So you need the decoder in the neural network to be linear in order to not break the idea of Koopman modes.

Dionysus7777777 commented 8 months ago

I apologize for the discrepancy in our understandings. I believe that using a nonlinear activation function in the decoder does not necessarily violate the Koopman theory. This is because the encoder and decoder are simply employed to obtain the Koopman operator through neural network methods. As you mentioned, Koopman theory is independent of neural networks, and therefore not strictly limited to linear methods. I have read some relevant papers that seem to support my perspective. You may refer to the paper "Deep learning for universal linear embeddings of nonlinear dynamics" by Bethany Lusch et al., which appears to use ReLU as an activation function. The issue I encountered while using your package seems to be related to this step. As I am just a university student, there may be some errors in my viewpoints, so I sincerely seek your guidance on this matter. Thank you for your time and response.

Dionysus7777777 commented 8 months ago

Deep learning for universal linear embeddings of nonlinear dynamics.pdf

pswpswpsw commented 8 months ago

Linear embedding is not the same as learning an invariant subspace that spans the state. I also had a published paper using nonlinear decoder, but I always say that's linear embedding, not to confuse with the classical approximation of Koopman operator.

Dionysus7777777 commented 8 months ago

thanks