Refactor/sdp structure cleanup#1126
Conversation
|
Review these changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1126 |
| QT = convolve(Qr, T) | ||
|
|
||
| return QT.real[m - 1 : n] | ||
| return sdp._sliding_dot_product(Q, T) |
There was a problem hiding this comment.
@seanlaw
Regarding core.sliding_dot_prodiuct: Is this what you meant when you said in this comment (see notes on PR 1):
- Make core.sliding_dot_product = sdp._sliding_dot_product
?
I think we should handle sdp._convolve_sliding_dot_product (see PR 2 in this comment) in this PR. The function core.sliding_dot_product in the branch main can be copied to the sdp module, and renamed to _convolve_sliding_dot_product. sdp._sliding_dot_product should point to sdp._convolve_sliding_dot_product. This is not a serious issue if the plan is to handle PR 2 quickly right after PR 1.
There was a problem hiding this comment.
Yes, that makes perfect sense. It's not actually new code or new SDP methods. It's simply a refactoring of existing code
There was a problem hiding this comment.
sdp._sliding_dot_product should point to sdp._convolve_sliding_dot_product
And then, in subsequent PRs, it should point to multiple functions using some branching logic, right?
| from stumpy import sdp | ||
|
|
||
|
|
||
| def naive_rolling_window_dot_product(Q, T): |
There was a problem hiding this comment.
We have a similar function in tests/test_core.py. Refactor and put this function in tests/naive.py.
There was a problem hiding this comment.
The only reason why I didn't want to put it in naive.py was because it wasn't actually being used in any other file except for test_core.py. The only time I would move a function to naive.py is when it was used across multiple test files.
There was a problem hiding this comment.
The only time I would move a function to naive.py is when it was used across multiple test files.
Noted. Since I am now using it in tests/test_sdp.py too, it makes sense to just move it to naive.py. Is that correct?
|
@seanlaw |
seanlaw
left a comment
There was a problem hiding this comment.
@NimaSarajpoor Looking good! This is much easier to track
| QT = convolve(Qr, T) | ||
|
|
||
| return QT.real[m - 1 : n] | ||
| return sdp._sliding_dot_product(Q, T) |
There was a problem hiding this comment.
Yes, that makes perfect sense. It's not actually new code or new SDP methods. It's simply a refactoring of existing code
| T_squared[i - 1] - T[i - 1] * T[i - 1] + T[i + m - 1] * T[i + m - 1] | ||
| ) | ||
| QT = _sliding_dot_product(Q, T) | ||
| QT = sdp._njit_sliding_dot_product(Q, T) |
There was a problem hiding this comment.
With the name being sdp._njit_sliding_dot_product, it actually makes logical sense. This _p_norm_distance_profile is an NJIT decorated function and, therefore, it MUST use an NJIT capable SDP function! I like that this distinction is clear and obvious
While core.sliding_dot_product is NOT necessarily an NJIT function (it could be but doesn't have to be).
There was a problem hiding this comment.
I like that this distinction is clear and obvious
While core.sliding_dot_product is NOT necessarily an NJIT function (it could be but doesn't have to be).
YES, and YES!!!
| QT = convolve(Qr, T) | ||
|
|
||
| return QT.real[m - 1 : n] | ||
| return sdp._sliding_dot_product(Q, T) |
There was a problem hiding this comment.
sdp._sliding_dot_product should point to sdp._convolve_sliding_dot_product
And then, in subsequent PRs, it should point to multiple functions using some branching logic, right?
| from stumpy import sdp | ||
|
|
||
|
|
||
| def naive_rolling_window_dot_product(Q, T): |
There was a problem hiding this comment.
The only reason why I didn't want to put it in naive.py was because it wasn't actually being used in any other file except for test_core.py. The only time I would move a function to naive.py is when it was used across multiple test files.
This is to address
PR 1described in this comment. Have copied the corresponding notes below: