Skip to content

Commit de64902

Browse files
committed
readme had old optimizer calls in it
1 parent 0dec1b3 commit de64902

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

README.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -121,30 +121,31 @@ So you can see more details about the API usage [there](https://pynumdiff.readth
121121
### Basic usages
122122

123123
* Basic Usage: you provide the parameters
124-
```bash
125-
x_hat, dxdt_hat = pynumdiff.sub_module.method(x, dt, params, options)
124+
```python
125+
from pynumdiff.submodule import method
126+
127+
x_hat, dxdt_hat = method(x, dt, params, options)
126128
```
127129
* Intermediate usage: automated parameter selection through multi-objective optimization
128-
```bash
129-
params, val = pynumdiff.optimize.sub_module.method(x, dt, params=None,
130-
tvgamma=tvgamma, # hyperparameter
131-
dxdt_truth=None, # no ground truth data
132-
options={})
133-
print('Optimal parameters: ', params)
134-
x_hat, dxdt_hat = pynumdiff.sub_module.method(x, dt, params, options={'smooth': True})`
130+
```python
131+
from pynumdiff.optimize import optimize
132+
133+
params, val = optimize(method, x, dt, search_space={'param1':[options], 'param2':[options], ...},
134+
tvgamma=tvgamma, # hyperparameter, defaults to None if dxdt_truth given
135+
dxdt_truth=None) # or give ground truth data, in which case tvgamma unused
136+
print('Optimal parameters: ', params)
137+
x_hat, dxdt_hat = method(x, dt, **params)`
135138
```
136139
* Advanced usage: automated parameter selection through multi-objective optimization using a user-defined cutoff frequency
137-
```bash
138-
# cutoff_freq: estimate by (a) counting the number of true peaks per second in the data or (b) look at power spectra and choose cutoff
139-
log_gamma = -1.6*np.log(cutoff_frequency) -0.71*np.log(dt) - 5.1 # see: https://ieeexplore.ieee.org/abstract/document/9241009
140-
tvgamma = np.exp(log_gamma)
141-
142-
params, val = pynumdiff.optimize.sub_module.method(x, dt, params=None,
143-
tvgamma=tvgamma, # hyperparameter
144-
dxdt_truth=None, # no ground truth data
145-
options={})
146-
print('Optimal parameters: ', params)
147-
x_hat, dxdt_hat = pynumdiff.sub_module.method(x, dt, params, options={'smooth': True})`
140+
```python
141+
# cutoff_freq: estimate by (a) counting the number of true peaks per second in the data or (b) look at power spectra and choose cutoff
142+
log_gamma = -1.6*np.log(cutoff_frequency) -0.71*np.log(dt) - 5.1 # see: https://ieeexplore.ieee.org/abstract/document/9241009
143+
tvgamma = np.exp(log_gamma)
144+
145+
params, val = optimize(method, x, dt, search_space={'param1':[options], 'param2':[options], ...},
146+
tvgamma=tvgamma)
147+
print('Optimal parameters: ', params)
148+
x_hat, dxdt_hat = method(x, dt, **params)`
148149
```
149150

150151
### Notebook examples
@@ -170,7 +171,7 @@ To run tests locally, type:
170171
> pytest pynumdiff
171172
```
172173

173-
Add the flag `--plot` to see plots of the methods against test functions.
174+
Add the flag `--plot` to see plots of the methods against test functions. Add the flag `--bounds` to print log error bounds (useful when changing method behavior).
174175

175176
## License
176177

0 commit comments

Comments
 (0)