Skip to content

Commit 37feb2c

Browse files
committed
CLN: remove SINDy.differentiate() and update DiscreteSINDy for feature overview notebook
1 parent 194b548 commit 37feb2c

File tree

2 files changed

+909
-565
lines changed

2 files changed

+909
-565
lines changed

examples/1_feature_overview/example.ipynb

Lines changed: 904 additions & 560 deletions
Large diffs are not rendered by default.

examples/1_feature_overview/example.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def ignore_specific_warnings():
114114
x_dot_test_predicted = model.predict(x_test)
115115

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

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

174174
model.print()
@@ -782,7 +782,7 @@ def f(x):
782782
x_dot_test_predicted = model.predict(x_test)
783783

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

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

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

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

0 commit comments

Comments
 (0)