Skip to content

mpdist throws error #95

Open
Open
@rcyost

Description

@rcyost

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):

  • OS: windows
  • Version matrixprofile 1.1.10
  • python 3.9.5

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions