Skip to content

Commit a24f1d8

Browse files
committed
updated outdated syntax in the notebooks
1 parent aa2bee1 commit a24f1d8

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

examples/2a_optimizing_parameters_with_dxdt_known.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,13 @@
9797
"from pynumdiff.optimize import optimize\n",
9898
"from pynumdiff.module import method\n",
9999
"\n",
100-
"search_space = {'param1':[values], 'param2':[values], ...}\n",
100+
"search_space_updates = {'param1':[values], 'param2':[values], ...}\n",
101101
"\n",
102-
"params, val = optimize(method, x, dt, search_space, \n",
102+
"params, val = optimize(method, x, dt,\n",
103103
" tvgamma=tvgamma, # hyperparameter\n",
104-
" dxdt_truth=dxdt_truth) # defaults to None if no ground truth data\n",
105-
" \n",
104+
" dxdt_truth=dxdt_truth, # defaults to None if no ground truth data\n",
105+
" search_space_updates=search_space_updates)\n",
106+
"\t\t\t\t\t\n",
106107
"x_hat, dxdt_hat = method(x, dt, **params)\n",
107108
"```\n",
108109
"\n",

examples/2b_optimizing_parameters_with_dxdt_unknown.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
},
109109
{
110110
"cell_type": "code",
111-
"execution_count": 3,
111+
"execution_count": 4,
112112
"metadata": {},
113113
"outputs": [
114114
{
@@ -137,11 +137,12 @@
137137
"from pynumdiff.optimize import optimize\n",
138138
"from pynumdiff.module import method\n",
139139
"\n",
140-
"search_space = {'param1':[values], 'param2':[values], ...}\n",
140+
"search_space_updates = {'param1':[values], 'param2':[values], ...}\n",
141141
"\n",
142-
"params, val = optimize(method, x, dt, search_space, \n",
142+
"params, val = optimize(method, x, dt,\n",
143143
" tvgamma=tvgamma, # hyperparameter\n",
144-
" dxdt_truth=dxdt_truth) # defaults to None if no ground truth data\n",
144+
" dxdt_truth=dxdt_truth, # defaults to None if no ground truth data\n",
145+
" search_space_updates=search_space_updates)\n",
145146
" \n",
146147
"x_hat, dxdt_hat = method(x, dt, **params)\n",
147148
"```\n",
@@ -520,7 +521,7 @@
520521
},
521522
{
522523
"cell_type": "code",
523-
"execution_count": 13,
524+
"execution_count": 6,
524525
"metadata": {},
525526
"outputs": [
526527
{

pynumdiff/optimize/_optimize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
{'s': (1e-2, 1e6),
6262
'num_iterations': (1, 10)}),
6363
tvrdiff: ({'gamma': [1e-2, 1e-1, 1, 10, 100, 1000],
64-
'order': {1, 2, 3}}, # categorical, because order is whole number, and there aren't many choices
64+
'order': {1, 2, 3}}, # warning: order 1 hacks the loss function when tvgamma is used, tends to win but is usually suboptimal choice in terms of true RMSE
6565
{'gamma': (1e-4, 1e7)}),
6666
velocity: ({'gamma': [1e-2, 1e-1, 1, 10, 100, 1000]},
6767
{'gamma': (1e-4, 1e7)}),

0 commit comments

Comments
 (0)