Repository navigation
Fixed #34 Add overlap-add convolve - #35
NimaSarajpoor wants to merge 38 commits into
Conversation
|
Review these changes at https://app.gitnotebooks.com/stumpy-dev/sliding_dot_product/pull/35 |
The challenger is the customized version of scipy's oaconvolve.
Observations:
For me, the important one is the first bullet point. Of the four optimization opportunities mentioned in this comment, I've addressed 1, 2, and 3 in this PR. The last item, which is about adjusting the number of multiplication for real-valued arrays, can be explored next. |
|
As a gentle reminder, even if we can do things faster, we will never (??) remove the public |
|
Good reminder. It makes sense!! |
|
|
||
|
|
||
| def test_oaconvolve_sdp_blocksize(): | ||
| from sdp.challenger_sdp import sliding_dot_product |
There was a problem hiding this comment.
This line needs to be modified if, at a later time, we decide to move the proposal to a new file (module).
@seanlaw |
There was a problem hiding this comment.
@NimaSarajpoor I've left some comments but would still like another pass after you've cleaned things up further
I do agree that, for the most part, things look clean. I think it still lacks clarity as to what is happening or why the logic is coded in this way
|
@seanlaw (1) I intentionally left a few things to be addressed in a different PR later for the function (2) I thought about refactoring '_pocketfft_circular_convolve_block' (in challenger_sdp.py) and '_pocketfft_valid_convolve' (in the changed file pocketfft_r2c_c2r_sdp.py). However, I couldn't find a clean way to do it. Maybe we need to create a new function and those both functions need to call that common function (??) |
@NimaSarajpoor Was there anything in particular that you wanted me to focus on. Frankly, I don't have enough details or context to follow most/all the oaconvolve/block size logic. It feels like I can only attempt to spot issues with programming logic but not issues with algorithmic logic (not unless you can spell out the problem in clear detail).
I'll try to take a look but it's not clear to me what this is currently referencing as I do not have sufficient context |
|
@seanlaw Perhaps I should add some more context to this PR (?) For example, I can create a notebook that walks through the overlap-add approach mathematically and shows why, in our particular case, it produces the same result as the direct valid convolution. Would something like that make the algorithmic logic easier to review? Or is there another kind of context that you think would be more useful? |
|
@NimaSarajpoor Yes, I think a notebook would be valuable. In most/all of the matrix profile work, we nearly always had a published paper to reference (and their code) and so it was easier to start from the same shared context and then we could evolve from there together. Here, I'm purely following you and the context that you give me. So, I think a detailed notebook (even with naive code snippets) would be quite helpful especially to "see" where the hard problem(s) are that need to be solved |
I implemented the overlap-add method from scratch, based on what I learned from the notebook developed in PR #43, and pushed the changes. Notes:
|
|
@seanlaw What do you think? |
You've put in a lot of hard work and effort into this and it really shows. I fully support you!
The only thing I'll ask is:
Otherwise, I am excited to see what you do! |
2b632ea to
a08e12b
Compare
|
As of the latest commit, the challenger is outperformed by scipy_oaconvolve_sdp.py (see image below). This is because the size of chunks in overlap-add is automatically set to
|
…y for an estimate
|
In commit 5fb0b08, I added a new notebook that digs into the topic of "chunk size" in overlap-add. Although there might be only a few candidates of chunk size for overlap-add on a given The relevant piece was changed in
|
|
That's wonderful! How does this compare with Matlab or is that not important? |
Thanks! Took me some time to figure things out and write them into a notebook.... but it was good! Still need to review the notebook and polish it again later with fresh eyes. I also need to add some references. Two key points are:
Three items come to my mind: (1) vs MATLAB's SDP via FFT/IFFT: Since the baseline in our plots is based on pyfftw, I think there is no need to compare with MATLAB again as we already compared pyfftw's performance with MATLAB before. IIRC, they were close. (2) vs MATLAB's SDP via fftfilt: I just found out about this MATLAB function, which performs overlap-add convolution. We can compare this PR's (3) vs MATLAB's SDP via MASS V3: It uses the logic behind overlap-save; however, it does not use the logic to perform divide and conquer on the convolution problem. It uses it to perform divide and conquer directly on the SDP problem. In other words, it breaks down the time series |




This PR is to address #34.