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
mass_absolute returns NaN for some negative time-series #286
Comments
@DanBenHa Thank you for this reproducer! You're right. It looks like it is trying to take the square root of a very small negative number so maybe we should just replace with:
And then, as you said, add this to our test suite. Would you like to submit a PR for this? Otherwise, I can do it |
Sure, I'll do it. My ad hoc solution was using more of numpy's syntactic sugar, i.e. |
Oooh, I like that (please go for it)! I learned something new too |
Ah, unfortunately numba doesn't support |
Here are some reference discussion (but no solution):
From what I can tell, the issue may be coming from imprecisions in the sliding dot product |
Thanks for posting the references! |
I found this while playing with the PAMAP dataset. Haven't been able to reproduce this with random numbers, so here's the relevant data and code.
I get
nan
, but of course it should be0
. The problem is some float imprecision in_mass_absolute
that leads to negative values that can't be properlynp.sqrt
ed.Easy to fix, of course. A test for this edge case should be added as well.
The text was updated successfully, but these errors were encountered: