-
Notifications
You must be signed in to change notification settings - Fork 24
robustdiff to address #97
#161
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a8af547
added robustdiff to kalman_smooth, added tests for it, added it to no…
pavelkomarov de68e28
added caching to optimization
pavelkomarov c0ec315
reran notebooks
pavelkomarov 5b3fd12
updated notebook
pavelkomarov 91dc1b7
trying to get tests to pass
pavelkomarov ca0f657
removed some commented-out code and adjusted an error bound, because …
pavelkomarov c99e6ca
adjusting error bounds more
pavelkomarov 4b7543b
tweaked docs
pavelkomarov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
164 changes: 101 additions & 63 deletions
164
examples/2a_optimizing_parameters_with_dxdt_known.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,11 @@ | ||
| """This module implements Kalman filters | ||
| """This module implements constant-derivative model-based smoothers based on Kalman filtering and its generalization. | ||
| """ | ||
| try: | ||
| import cvxpy | ||
| except: | ||
| from warnings import warn | ||
| warn("CVXPY is not installed; robustdiff and l1_solve not available.") | ||
| else: # runs if try was successful | ||
| from ._kalman_smooth import robustdiff, convex_smooth | ||
|
|
||
| from ._kalman_smooth import kalman_filter, rts_smooth, rtsdiff, constant_velocity, constant_acceleration, constant_jerk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| from ..basis_fit import spectraldiff, rbfdiff | ||
| from ..polynomial_fit import polydiff, savgoldiff, splinediff | ||
| from ..total_variation_regularization import velocity, acceleration, jerk, iterative_velocity, smooth_acceleration, jerk_sliding | ||
| from ..kalman_smooth import rtsdiff, constant_velocity, constant_acceleration, constant_jerk | ||
| from ..kalman_smooth import rtsdiff, constant_velocity, constant_acceleration, constant_jerk, robustdiff | ||
| from ..smooth_finite_difference import mediandiff, meandiff, gaussiandiff, friedrichsdiff, butterdiff | ||
| # Function aliases for testing cases where parameters change the behavior in a big way, so error limits can be indexed in dict | ||
| def iterated_second_order(*args, **kwargs): return second_order(*args, **kwargs) | ||
|
|
@@ -59,6 +59,7 @@ def spline_irreg_step(*args, **kwargs): return splinediff(*args, **kwargs) | |
| (lineardiff, {'order':3, 'gamma':5, 'window_size':11, 'solver':'CLARABEL'}), (lineardiff, [3, 5, 11], {'solver':'CLARABEL'}), | ||
| (rbfdiff, {'sigma':0.5, 'lmbd':0.001}) | ||
| ] | ||
| diff_methods_and_params = [(robustdiff, {'order':3, 'qr_ratio':1e6})] | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gotta remove this next commit. Should test all. |
||
|
|
||
| # All the testing methodology follows the exact same pattern; the only thing that changes is the | ||
| # closeness to the right answer various methods achieve with the given parameterizations and random seed. | ||
|
|
@@ -210,6 +211,12 @@ def spline_irreg_step(*args, **kwargs): return splinediff(*args, **kwargs) | |
| [(-2, -3), (0, 0), (0, -1), (1, 1)], | ||
| [(-1, -2), (1, 1), (0, -1), (1, 1)], | ||
| [(0, 0), (3, 3), (0, 0), (3, 3)]], | ||
| robustdiff: [[(-25, -25), (-15, -15), (0, -1), (0, 0)], | ||
| [(-14, -14), (-13, -13), (0, -1), (0, 0)], | ||
| [(-14, -14), (-13, -13), (0, -1), (0, 0)], | ||
| [(-1, -1), (0, 0), (0, -1), (1, 0)], | ||
| [(0, 0), (1, 1), (0, 0), (1, 1)], | ||
| [(1, 1), (3, 3), (1, 1), (3, 3)]], | ||
| spectraldiff: [[(-9, -10), (-14, -15), (-1, -1), (0, 0)], | ||
| [(0, 0), (1, 1), (0, 0), (1, 1)], | ||
| [(1, 1), (1, 1), (1, 1), (1, 1)], | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
might also need
huberMto be a hyperparameter. Maybe discrete, because we want to hit 0 on the dot.