Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,464 changes: 904 additions & 560 deletions examples/1_feature_overview/example.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions examples/1_feature_overview/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def ignore_specific_warnings():
x_dot_test_predicted = model.predict(x_test)

# Compute derivatives with a finite difference method, for comparison
x_dot_test_computed = model.differentiate(x_test, t=dt)
x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt)

fig, axs = plt.subplots(x_test.shape[1], 1, sharex=True, figsize=(7, 9))
for i in range(x_test.shape[1]):
Expand Down Expand Up @@ -168,7 +168,7 @@ def f(x):
x_train_map[0] = 0.5
for i in range(1, n_steps):
x_train_map[i] = f(x_train_map[i - 1]) + eps * np.random.randn()
model = ps.SINDy(discrete_time=True)
model = ps.DiscreteSINDy()
model.fit(x_train_map, t=1)

model.print()
Expand Down Expand Up @@ -782,7 +782,7 @@ def f(x):
x_dot_test_predicted = model.predict(x_test)

# Compute derivatives with a finite difference method, for comparison
x_dot_test_computed = model.differentiate(x_test, t=dt)
x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt)

fig, axs = plt.subplots(x_test.shape[1], 1, sharex=True, figsize=(7, 9))
for i in range(x_test.shape[1]):
Expand Down Expand Up @@ -905,7 +905,7 @@ def u_fun(t):
x_dot_test_predicted = model.predict(x_test, u=u_test)

# Compute derivatives with a finite difference method, for comparison
x_dot_test_computed = model.differentiate(x_test, t=dt)
x_dot_test_computed = model.differentiation_method._differentiate(x_test, t=dt)

fig, axs = plt.subplots(x_test.shape[1], 1, sharex=True, figsize=(7, 9))
for i in range(x_test.shape[1]):
Expand Down Expand Up @@ -1105,7 +1105,7 @@ def u_fun(t):
num_parameters=1,
)
opt = ps.STLSQ(threshold=1e-1, normalize_columns=False)
model = ps.SINDy(feature_library=lib, optimizer=opt, discrete_time=True)
model = ps.DiscreteSINDy(feature_library=lib, optimizer=opt)
model.fit(xs_train, u=rs_train, t=1, feature_names=["x", "r"])
model.print()

Expand Down
3 changes: 3 additions & 0 deletions pysindy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
from . import optimizers
from . import deeptime
from . import utils

from ._core import SINDy
from ._core import DiscreteSINDy
from ._core import AxesArray
from .differentiation import BaseDifferentiation
from .differentiation import FiniteDifference
Expand Down Expand Up @@ -65,6 +67,7 @@

__all__ = [
"SINDy",
"DiscreteSINDy",
"differentiation",
"feature_library",
"optimizers",
Expand Down
Loading