wannesm / dtaidistance

Time series distances: Dynamic Time Warping (fast DTW implementation in C)
Other
1.08k stars 184 forks source link

Unable to run clustering exemple #182

Closed Axel-CH closed 1 year ago

Axel-CH commented 1 year ago

Hello, I'm having Issue runing the clustering exemple, I don't know why, but the Hierarchical clusturing does not work.

Bellow the exemple code:

series = np.matrix([
     [0., 0, 1, 2, 1, 0, 1, 0, 0],
     [0., 1, 2, 0, 0, 0, 0, 0, 0],
     [1., 2, 0, 0, 0, 0, 0, 1, 1],
     [0., 0, 1, 2, 1, 0, 1, 0, 0],
     [0., 1, 2, 0, 0, 0, 0, 0, 0],
     [1., 2, 0, 0, 0, 0, 0, 1, 1]])
ds = dtw.distance_matrix_fast(series, block=((1, 4), (3, 5)))

model1 = clustering.Hierarchical(dtw.distance_matrix_fast, {})
cluster_idx = model1.fit(series)

model1.plot("myplot.png")

The result:

image

As you can see, the clustering process stop itself at 83% and the model have missing attributes. Do you know what could cause that?

Details on my env: dtaidistance 2.3.9 matplotlib 3.6.0 Python 3.8.3 (default, Jul 2 2020, 16:21:59) [GCC 7.3.0] :: Anaconda, Inc. on linux

Thank you for you help

Axel-CH commented 1 year ago

My Bad the mistake was on my side, I had to use model that keep track of the full clustering tree