matrix-profile-foundation / matrixprofile

A Python 3 library making time series data mining tasks, utilizing matrix profile algorithms, accessible to everyone.
https://matrixprofile.org
Apache License 2.0
362 stars 62 forks source link

mpdist throws error #95

Open rcyost opened 2 years ago

rcyost commented 2 years ago

Describe the bug When using algorithms that rely on distance like hierarchical cluster or pairwise_dist I get an error.

----> [273](file:///c%3A/Users/yosty/Desktop/Desktop_Folder/14%20-%20git/matrix_profile/fed_mp.py?line=272) mp.discover.hierarchical_clusters(ts, 52, t=1)
      [274](file:///c%3A/Users/yosty/Desktop/Desktop_Folder/14%20-%20git/matrix_profile/fed_mp.py?line=273) 

~\AppData\Roaming\Python\Python39\site-packages\matrixprofile\algorithms\hierarchical_clustering.py in hierarchical_clusters(X, window_size, t, threshold, method, depth, criterion, n_jobs)
    130         raise ValueError('criterion may only be one of: ' + opts_str)
    131 
--> 132     Y = pairwise_dist(X, window_size, threshold=threshold, n_jobs=n_jobs)
    133     Z = linkage(Y, method=method)
    134     R = inconsistent(Z, d=depth)

~\AppData\Roaming\Python\Python39\site-packages\matrixprofile\algorithms\pairwise_dist.py in pairwise_dist(X, window_size, threshold, n_jobs)
     82         for i in range(0, m - 1):
     83             for j in range(i + 1, m):
---> 84                 dm[k] = mpdist(X[i], X[j], window_size, threshold=threshold, 
     85                             n_jobs=n_jobs)
     86                 k = k + 1

~\AppData\Roaming\Python\Python39\site-packages\matrixprofile\algorithms\mpdist.py in mpdist(ts, ts_b, w, threshold, n_jobs)
     49 
     50     """
...
--> 100         raise ValueError('Unable to convert to np.ndarray!')
    101 
    102     return np.array(a)

ValueError: Unable to convert to np.ndarray!

To Reproduce Steps to reproduce the behavior:

  1. Given an time series array ts
  2. '''mp.discover.hierarchical_clusters(ts, 52, t=1)'''

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context the t parameter in hierarchical_clusters should have a range given to users

fanyucode commented 1 year ago

I also meet this problem.Are you slove the problem?