matrixprofile-ts icon indicating copy to clipboard operation
matrixprofile-ts copied to clipboard

motifs.motifs throws exceptions on larger arrays

Open watsondavetrendalyze opened this issue 4 years ago • 1 comments

I have a timeseries (pattern) of length 44,640 (1 month) and a segment (m) length of 60

Exception thrown on this array but not on subset with 10080 points (1 week)

mp = matrixProfile.stomp(pattern,m)

I am getting the following error:

OverflowError Traceback (most recent call last) in 52 ax.legend() 53 ---> 54 mtfs ,motif_d = motifs.motifs(pattern, mp, max_motifs=10) 55 print('top motifs: \n',mtfs) 56 print('top distances: \n',motif_d)

~/.local/lib/python3.6/site-packages/matrixprofile/motifs.py in motifs(ts, mp, max_motifs, radius, n_neighbors, ex_zone) 57 motif_set = set() 58 initial_motif = [min_idx] ---> 59 pair_idx = int(mp[1][min_idx]) 60 if mp_current[pair_idx] != np.inf: 61 initial_motif += [pair_idx]

OverflowError: cannot convert float infinity to integer

When I run the same on 10080 points it runs fine and is very fast.

The same data runs fine with MASS2, MASS3 and Stumped over much larger time series > 1.6M rows

Attached in a ZIP file with sample data MP Debug 1.zip

watsondavetrendalyze avatar Sep 15 '19 09:09 watsondavetrendalyze

I was able to debug further and I see the matrixProfile.stomp(pattern,m) is returning some NaN values over some range in the data. I do not get this issue on other ranges nor on when using MASS2 and MASS3 on same range that gave the exception. As example the attached works without exception.

coinbase_1month_june_debugtest.zip

watsondavetrendalyze avatar Sep 15 '19 11:09 watsondavetrendalyze