Skip to content

Commit

Permalink
updated deprecated calls in example notebooks; prevented base optimiz…
Browse files Browse the repository at this point in the history
…er from unnecessarily copying Theta to conserve memory for PDEs
  • Loading branch information
znicolaou committed Dec 2, 2023
1 parent 525d818 commit 7454094
Show file tree
Hide file tree
Showing 24 changed files with 2,571 additions and 2,147 deletions.
113 changes: 70 additions & 43 deletions examples/11_SSR_FROLS_examples.ipynb

Large diffs are not rendered by default.

291 changes: 125 additions & 166 deletions examples/13_ensembling.ipynb

Large diffs are not rendered by default.

140 changes: 60 additions & 80 deletions examples/14_cavity_flow.ipynb

Large diffs are not rendered by default.

368 changes: 150 additions & 218 deletions examples/15_pysindy_lectures.ipynb

Large diffs are not rendered by default.

845 changes: 729 additions & 116 deletions examples/16_noise_robustness/16_benchmark_paper.ipynb

Large diffs are not rendered by default.

21 changes: 2 additions & 19 deletions examples/16_noise_robustness/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def Pareto_scan_ensembling(
ps.FiniteDifference(axis=-2),
ps.AxesArray(x_test_list[i], axes={"ax_time": 0, "ax_coord": 1}),
t_test_list[i],
)
)[1]
for i in range(len(x_test_list))
]
mats = poly_library.fit_transform(
Expand Down Expand Up @@ -606,7 +606,7 @@ def Pareto_scan_ensembling(
x_test_list[i], axes={"ax_time": 0, "ax_coord": 1}
),
t_test_list[i],
)
)[1]
for i in range(len(x_test_list))
]
mats = lib2.fit_transform(
Expand Down Expand Up @@ -904,8 +904,6 @@ def hyperparameter_scan_stlsq(
model.fit(
x_train,
t=t_train,
quiet=True,
multiple_trajectories=True,
)
condition_number = np.linalg.cond(optimizer.Theta_)

Expand All @@ -918,7 +916,6 @@ def hyperparameter_scan_stlsq(
AIC_best = np.zeros(n_models)
error_rmse_new = np.zeros(n_models)
error_rmse = np.zeros(n_models)

for i in range(n_models):
x_dot_test_pred = [coef_best[i].dot(mat.T).T for mat in mats]
dx_test = np.array(x_dot_test).reshape(n_trajectories * n_time, n_state)
Expand Down Expand Up @@ -960,8 +957,6 @@ def hyperparameter_scan_stlsq(
model.fit(
x_train,
t=t_train,
quiet=True,
multiple_trajectories=True,
)

# For each model, compute x_dot_test and compute the RMSE error
Expand Down Expand Up @@ -1140,8 +1135,6 @@ def hyperparameter_scan_lasso(
model.fit(
x_train,
t=t_train,
quiet=True,
multiple_trajectories=True,
)
condition_number = np.linalg.cond(optimizer.Theta_)

Expand Down Expand Up @@ -1193,8 +1186,6 @@ def hyperparameter_scan_lasso(
model.fit(
x_train,
t=t_train,
quiet=True,
multiple_trajectories=True,
)

# For each model, compute x_dot_test and compute the RMSE error
Expand Down Expand Up @@ -1377,8 +1368,6 @@ def hyperparameter_scan_sr3(
model.fit(
x_train,
t=t_train,
quiet=True,
multiple_trajectories=True,
)
condition_number = np.linalg.cond(optimizer.Theta_)

Expand Down Expand Up @@ -1436,8 +1425,6 @@ def hyperparameter_scan_sr3(
model.fit(
x_train,
t=t_train,
quiet=True,
multiple_trajectories=True,
)

# For each model, compute x_dot_test and compute the RMSE error
Expand Down Expand Up @@ -1615,8 +1602,6 @@ def hyperparameter_scan_miosr(
model.fit(
x_train,
t=t_train,
quiet=True,
multiple_trajectories=True,
)
condition_number = np.linalg.cond(optimizer.Theta_)
tol_iter = np.shape(optimizer.Theta_)[1] - 1
Expand Down Expand Up @@ -1674,8 +1659,6 @@ def hyperparameter_scan_miosr(
model.fit(
x_train,
t=t_train,
quiet=True,
multiple_trajectories=True,
)

# For each model, compute x_dot_test and compute the RMSE error
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 7454094

Please sign in to comment.