PySINDy
Sparse regression over a supplied candidate library, solved in one pass.
Usage
import kd
dataset = kd.load_burgers()
model = kd.Model(algorithm="pysindy")
model.fit(dataset)
print(model.best_expr_)
Main parameters
| Parameter | Default | Resume | Description |
|---|---|---|---|
threshold |
0.1 |
init-only | STLSQ sparsity threshold. |
max_iter |
20 |
init-only | Maximum STLSQ iterations. |
normalize_columns |
False |
init-only | Normalize library columns before STLSQ. |
All fields of PySINDyConfig
| Field | Type | Default |
|---|---|---|
terms |
tuple[str, ...] |
('u', 'u_x', 'u_xx', 'mul(u, u_x)') |
threshold |
float |
0.1 |
max_iter |
int |
20 |
normalize_columns |
bool |
False |
unbias |
bool |
True |
seed |
int |
0 |
extra_optimizer_kwargs |
dict[str, Any] \| None |
None |
The KD wrapper
PySINDy is a third-party package, installed separately, and its authors document the method itself. The points below are specific to driving it from KD.
It runs once. One sparse-regression solve answers the whole run, so a KD run has a single iteration rather than a search curve across generations.
KD supplies the derivatives and the library; PySINDy supplies the solve.
PySINDyConfig.terms is the set of candidate term columns, written in KD's
function-call notation, and the sequentially thresholded least squares over them
is PySINDy's own.
The coefficients are PySINDy's own. Its full coefficient vector is kept in
the result, so best_expr_ prints the coefficients the solve produced, without
an intervening refit. best_score_ follows from the same coefficients: it is
their NMSE on the data of that run, where lower is better.
Anything else the optimizer accepts goes through extra_optimizer_kwargs,
unchanged.
References
de Silva et al. (2020). "PySINDy: A Python package for the sparse identification of nonlinear dynamical systems from data". J. Open Source Softw. 5(49), 2104. Paper
Kaptanoglu et al. (2022). "PySINDy: A comprehensive Python package for robust sparse system identification". J. Open Source Softw. 7(69), 3994. Paper
Documentation: pysindy.readthedocs.io/en/latest
Code: dynamicslab/pysindy