-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add option to regularize linear fits #17
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #17 +/- ##
==========================================
+ Coverage 98.94% 98.96% +0.02%
==========================================
Files 4 4
Lines 1700 1738 +38
==========================================
+ Hits 1682 1720 +38
Misses 18 18
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
hera_filters/tests/test_dspec.py
Outdated
# Compare regularized regression to standard least squares | ||
mdl_reg, res_reg, _ = dspec.fourier_filter(freqs, d, w, [0.], [700e-9], suppression_factors=[0.], | ||
mode='dpss_solve', ridge_alpha=1e-3, eigenval_cutoff=[1e-12]) | ||
mdl, res, _ = dspec.fourier_filter(freqs, d, w, [0.], [700e-9], suppression_factors=[0.], | ||
mode='dpss_solve', eigenval_cutoff=[1e-12]) |
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.
Should we test the other solvers that use ridge alphas?
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.
Specifically matrix and leastsq
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.
Looks good. Thanks so much!
This PR adds the option to regularize linear least squares fits of DPSS and DFT bases to data as is done in
dspec.fourier_filter
. Regularizing these fits is particularly useful in preventing pop-ups as are seen when fitting DPSS basis vectors to data with wide gaps. Here's an example of using regularizing with the DPSS basis on simulated data with a large gap relative to the filter size.