Comments (4)
Ok, that makes sense. SINDy
models' default differentiation method is FiniteDifference(axis=-2)
, but this is ignored if you pass x_dot
. (in the current branch we label the array axes when the problem is created so we can be more explicit with FiniteDifference(axis=x.ax_time)
)
MIOSR
optimizer, or Mixed-Integer Optimization, Sparse Regression, allows you to specify exactly how many terms should be included. SR3
(and her subclasses) allow a direct penalty on the number of terms with an L-0 penalty. SBR
coming soon to a theater near you (#440) will give you a bit more control over the penalty for how many terms are nonzero and how far they're allowed to wander from the origin.
That said, I don't think any optimizer allows you to select a maximum term.
from pysindy.
Noted. So I understand that the approach I took is "SINDy-friendly" and appropriate to solve the problem I indented. Will also play a bit more with the optimizers. Thanks again for all the info!
from pysindy.
Ideally, if your method of generating derivatives would be useful to other people, you could write a BaseDifferentiation subclass (or fork derivative
package and add a method to their API, which SINDyDerivative
uses under the hood) and PR it.
A bit of clarification: lets say you have calculated u_t
u_tt
in as a candidate, the system ought to find it's coefficient is 1.
IIUC and you are looking for an Nth time-order PDE with a linear term on that Nth time derivative, here's how:
- Your independent variable should be the second-highest temporal derivative. This is the
x
inSINDy.fit
- Your highest temporal derivative is the
x_dot
inSINDy.fit
- Stack and pass all your other pre-calculated derivatives as control variables except for the highest temporal derivative. Stack along the -1 axis, which we call the coordinate axis. This is the
u
parameter inSINDy.fit
If instead you're looking for something nonlinear in the Nth order like x
would be all terms with less than x_dot
would be all terms with at least one time derivative. The caveat is that it will fit M models, where M is the number of features expressed by applying the feature library to x
, and you need to visually scan the results to find one that looks reasonable.
from pysindy.
Thank you for the detailed reply. The derivatives I am taking currently are WIP, but I will definitely try to contribute to this repo once I have a more validated approach.
In general, I have a dynamical system such that XT
is the space-time grid containing N
samples :
- Compute feature arrays and target data
$u_t$ (dudt
)
u = f(XT)
dudx = ddx(u, XT)
d2udx2 = d2dx2(u, XT)
...
features = np.stack([u, dudx, d2udx2,...], axis=-1)
dudt = ddt(u,XT)
- Fit polynomial library of
p
order
model_ps = ps.SINDy(feature_library=ps.PolynomialLibrary(degree=p, include_bias=False), optimizer=ps.STLSQ())
model_ps.fit(features, x_dot=dudt)
Even though this usually spits out the correct PDE, I am not sure is the best it approach. For example, print(model_ps)
shows differentiation_method=FiniteDifference(axis=-2)
, and I am unsure if this is doing something under the hood.
Also, I would like to ask if there is any specific way to cap the maximum number of terms that the optimizer can include in the expression. And, in this sense, I have observed that the only optimizer that could find the correct expression was STLSQ
, the others I tried did not manage to do so. What optimizer should be best suited for this problem?
Thanks!
from pysindy.
Related Issues (20)
- Incorporate make_constraints into trapping_sr3.py HOT 8
- Initial Guess - SR3 - Custom Library [BUG] HOT 3
- [Help] Can't get the right model for 2d system HOT 3
- [DOC] WeakPDELibrary.transform does not produce output in shape specified by documentation.
- Help in figuring out the cause behind TypeError while fitting with tensor libraries HOT 7
- Optimizer for SINDy-PI feature of implicit ODEs HOT 7
- Let model.print() respect the same kwargs as print()
- Use `x_dot` kwarg in `model.fit` in PDEs with `WeakPDELibrary()`
- constraint_separation_index undocumented
- Do we need `test_trapping_cubic_library()`? HOT 1
- Make `IdentityLibrary` a subclass of `PolynomialLibrary`
- Make models guaranteed pickleable
- Error in '3_original_Paper' Example: Missing 'quiet' Argument in pysindy.py HOT 1
- Remove research experiments from pysindy HOT 4
- [Question]How model.predict() works for implicit ODEs function? HOT 14
- [BUG] pytest-lazy-fixture may be dead, blocking pytest upgrades HOT 1
- `np.median(model.coef_list, axis=0)` does not give the same answer as `model.print()` from first example in ensembling documentation HOT 2
- [BUG] SINDyDerivative does not handle PDEs HOT 2
- Feature request: Manually set coefficients HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pysindy.