-
Notifications
You must be signed in to change notification settings - Fork 16
Fix smoother to remove a non-invertible design matrix bug #476
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
predicted_value = signal @ coeffs | ||
return predicted_value | ||
|
||
def savgol_coeffs(self, nl, nr): | ||
def savgol_coeffs(self, nl, nr, poly_fit_degree): |
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.
add docstring for the new param.
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.
Done.
signal_imputed[ix - self.window_length : ix] @ coeffs | ||
signal_imputed[ix] = self.savgol_predict( | ||
signal_imputed[ix - self.window_length : ix], | ||
2, |
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.
How big of a difference is it using a quadratic polynomial vs the previous window_length degree polynomial (assuming im reading this right)?
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.
Hm, now I think I should make a different PR and start a discussion there for this. This change is unrelated to the matrix bug.
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.
Took this change out.
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.
👍. the rest of the PR looks good. One thing that I like to do when fixing a bug is write out the test case that would cause the bug and code until it passes. Then just leave it in as a test case and you have some confidence that it's resolved.
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.
Nice idea, I'll try that.
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.
sounds good, will approve once a test is added
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.
Added a test!
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.
And a few other bad input tests for the sake of code coverage (couldn't help myself :P).
b1de029
to
7a13567
Compare
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.
7a13567
to
a5f81ba
Compare
The error arose in the case of imputation with fewer datapoints than polynomial degree. Fixes #448. I also modified the imputation to change the polynomial fit degree at that boundary edge case and to use quadratic fitting by default (this is because imputing with polynomial_fit_degree=0 does a really poor job, so shouldn't ever be used).