-
Notifications
You must be signed in to change notification settings - Fork 24
Simulation and Evaluation code inspection #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| :param markersize: marker size of noisy observations | ||
| :type markersize: int, optional | ||
| :param np.array[float] x: array of noisy data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just shortening docstrings per #71.
pynumdiff/utils/evaluate.py
Outdated
| def __rms_error__(a, e): | ||
| """ | ||
| Calculate rms error | ||
| def _rms_error(a, e): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calls to this should maybe be replaced with numpy.linalg.norm.
…will no longer work in the 2a notebook
| "source": [ | ||
| "import os\n", | ||
| "import sys\n", | ||
| "import time\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused imports
| Import useful functions from the optimize module | ||
| """ | ||
|
|
||
| import logging as _logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raising a warning instead of logging now
|
|
||
| :param x_hat: estimated (smoothed) x | ||
| :type x_hat: np.array | ||
| def metrics(x, dt, x_hat, dxdt_hat, x_truth=None, dxdt_truth=None, padding=0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
padding was default removing 2.5% on either end of the data. I think default behavior should be to calculate the metric on the full data, so I've changed the default to 0. If called with None or 'auto', 2.5% automatic slicing is still available.
| """ | ||
| _np.random.seed(random_seed) | ||
| timeseries_length = _np.max(x.shape) | ||
| noise = _np.random.__getattribute__(noise_type)(noise_parameters[0], noise_parameters[1], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing noise_parameters[0], noise_parameters[1] only works if there are two parameters, like for normal. For poisson this wouldn't work, so I've changed this to be variable arguments with a *.
| - None: dummy output | ||
|
|
||
| :rtype: tuple -> (np.array, np.array, np.array, None) | ||
| def sine(duration=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timeseries_length is confusing terminology, necessitating clarification in the docstring. I've changed the name to duration to be more precise about what this thing is.
|
This one has gotten to be pretty big despite not being very consequential, just moving comments around and deduping stuff. I'm merging it, and I'll work on the optimizer some more in a subsequent PR. |
This one is ongoing. As I've read through some of the code, there were some obvious things I could do, but the majority of this one lies ahead. Opening early, because I sometimes feel it's helpful to be able to look at the diff visually as I go.