Skip to content
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

Fix mass absolute nan #288

Merged
merged 2 commits into from Dec 2, 2020
Merged

Conversation

plodocus
Copy link
Contributor

@plodocus plodocus commented Dec 2, 2020

Fixes #286

Pull Request Checklist

Below is a simple checklist but please do not hesitate to ask for assistance!

  • Fork, clone, and checkout the newest version of the code
  • Create a new branch
  • Make necessary code changes
  • Install black (i.e., python -m pip install black or conda install -c conda-forge black)
  • Install flake8 (i.e., python -m pip install flake8 or conda install -c conda-forge flake8)
  • Install pytest-cov (i.e., python -m pip install pytest-cov or conda install -c conda-forge pytest-cov)
  • Run black . in the root stumpy directory
  • Run flake8 . in the root stumpy directory
  • Run ./setup.sh && ./test.sh in the root stumpy directory
  • Reference a Github issue (and create one if one doesn't already exist)

@seanlaw
Copy link
Contributor

seanlaw commented Dec 2, 2020

@DanBenHa Thank you for the PR! I couldn't find much information on when negative values may occur except for one article that simply set those values to zero before taking the square root. I am wondering if there are situations where setting the negative values to zero is wrong?

Otherwise, everything else looks good and this should be ready to merge.

@plodocus
Copy link
Contributor Author

plodocus commented Dec 2, 2020

I am wondering if there are situations where setting the negative values to zero is wrong?

Good question. I don't know. But that would imply calculating a complex value for the distance of two real-valued vectors. Would that make sense?

@codecov-io
Copy link

codecov-io commented Dec 2, 2020

Codecov Report

Merging #288 (593098f) into master (4adf60a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #288   +/-   ##
=======================================
  Coverage   99.82%   99.82%           
=======================================
  Files          19       19           
  Lines        1732     1734    +2     
=======================================
+ Hits         1729     1731    +2     
  Misses          3        3           
Impacted Files Coverage Δ
stumpy/core.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4adf60a...593098f. Read the comment docs.

@seanlaw
Copy link
Contributor

seanlaw commented Dec 2, 2020

Good question. I don't know. But that would imply calculating a complex value for the distance of two real-valued vectors. Would that make sense?

Since negative values imply some sort of deficiency in the numerical precision, I think what I'm really asking is if there might be situations where the amplitude of the negative value may be indicative of something that is a lot worst (while a small, near zero amplitude is due to numerical precision). Just thinking out loud here though :)

@plodocus
Copy link
Contributor Author

plodocus commented Dec 2, 2020

Since negative values imply some sort of deficiency in the numerical precision, I think what I'm really asking is if there might be situations where the amplitude of the negative value may be indicative of something that is a lot worst (while a small, near zero amplitude is due to numerical precision). Just thinking out loud here though :)

I see. I guess it could be indicative of problems in the computation of Q_squared, T_squared and QT, so primarily in the functions rolling_is_finite, sliding_dot_product and rolling_window.

@seanlaw
Copy link
Contributor

seanlaw commented Dec 2, 2020

Okay, I spent most of my morning looking for an ideal solution and, while there were many discussions, there were no obvious solutions

@seanlaw seanlaw merged commit 94cbda2 into TDAmeritrade:master Dec 2, 2020
@plodocus plodocus deleted the fix_mass_absolute_nan branch December 3, 2020 08:42
@plodocus
Copy link
Contributor Author

plodocus commented Dec 3, 2020

Okay, I spent most of my morning looking for an ideal solution and, while there were many discussions, there were no obvious solutions

Haha, reminds me of some of my mornings ;)

Thanks for merging and the interesting question raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mass_absolute returns NaN for some negative time-series
3 participants