Skip to content

Commit aa2bee1

Browse files
committed
identified a bug where (True, False) was still tuple rather than set in optimize dicts. Reran notebooks, because I hadn't done that in a bit.
1 parent be8166c commit aa2bee1

4 files changed

Lines changed: 28 additions & 42 deletions

File tree

examples/2a_optimizing_parameters_with_dxdt_known.ipynb

Lines changed: 8 additions & 22 deletions
Large diffs are not rendered by default.

examples/2b_optimizing_parameters_with_dxdt_unknown.ipynb

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

examples/3_automatic_method_suggestion.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"name": "stderr",
9090
"output_type": "stream",
9191
"text": [
92-
"100%|██████████| 13/13 [06:00<00:00, 27.72s/it]\n"
92+
"100%|██████████| 13/13 [01:52<00:00, 8.68s/it]\n"
9393
]
9494
}
9595
],
@@ -107,7 +107,7 @@
107107
"name": "stdout",
108108
"output_type": "stream",
109109
"text": [
110-
"Best method: spectraldiff with params: {'high_freq_cutoff': np.float64(0.08875000000000002), 'even_extension': True, 'pad_to_zero_dxdt': True}\n",
110+
"Best method: spectraldiff with params: {'high_freq_cutoff': np.float64(0.08906250000000004), 'even_extension': True, 'pad_to_zero_dxdt': True}\n",
111111
"RMS error in velocity: 0.49878946932177715\n",
112112
"Error correlation: 0.00898759811682361\n"
113113
]
@@ -147,7 +147,7 @@
147147
"name": "stderr",
148148
"output_type": "stream",
149149
"text": [
150-
"100%|██████████| 13/13 [01:53<00:00, 8.69s/it]\n"
150+
"100%|██████████| 13/13 [01:54<00:00, 8.80s/it]\n"
151151
]
152152
}
153153
],

pynumdiff/optimize/_optimize.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@
7474
'window_size': [3, 10, 30, 50, 90, 130]},
7575
{'gamma': (1e-4, 1e7),
7676
'window_size': (3, 1000)}),
77-
rts_const_deriv: ({'forwardbackward': (True, False),
77+
rts_const_deriv: ({'forwardbackward': {True, False},
7878
'order': {1, 2, 3}, # for this few options, the optimization works better if this is categorical
7979
'qr_ratio': [1e-16, 1e-12] + [10**k for k in range(-9, 10, 2)] + [1e12, 1e16]},
8080
{'qr_ratio': [1e-20, 1e20]}),
81-
constant_velocity: ({'forwardbackward': (True, False),
81+
constant_velocity: ({'forwardbackward': {True, False},
8282
'q': [1e-8, 1e-4, 1e-1, 1e1, 1e4, 1e8],
8383
'r': [1e-8, 1e-4, 1e-1, 1e1, 1e4, 1e8]},
8484
{'q': (1e-10, 1e10),
@@ -246,7 +246,7 @@ def suggest_method(x, dt, dxdt_truth=None, cutoff_frequency=None):
246246

247247
best_value = float('inf') # core loop
248248
for func in tqdm(methods):
249-
p, v = optimize(func, x, dt, dxdt_truth=dxdt_truth, tvgamma=tvgamma, search_space_updates=({'order':(2,3)} if func==tvrdiff else {})) # TVR with order 1 hacks the cost function
249+
p, v = optimize(func, x, dt, dxdt_truth=dxdt_truth, tvgamma=tvgamma, search_space_updates=({'order':{2,3}} if func==tvrdiff else {})) # TVR with order 1 hacks the cost function
250250
if v < best_value:
251251
method = func
252252
best_value = v

0 commit comments

Comments
 (0)