# How to reach time points clustering?

What I met a problem is I do time-series clustering, and I found the clustering result isn't ideal.

I can't use elbow method to know what clustering result is good, that means I have no ways to watch the clustering results and tune parameters.

What I want to do is cluster the same trends data into the same group.

But I met a problem like below:

>> arr # It's a time-series array with 10 time intervals.
array([[  0,   0,   100, 0,   0,   0,   0,   0,   0,   0],
[  0,   0,   0,   0,   0,   0,   0,   0, 100,   0],
[100,   0,   0,   0,   0,   0,   0,   0,   0,   0]])

>> model = KM(n_clusters=2).fit(arr) ; model.labels_
array([1, 0, 0], dtype=int32)


It clusters arr[1] and arr[2] the same group!

But!With our eye watching, we all know arr[0] and arr[2] should be the same group because they have 100 in the near time intervals.

How to do time-points clustering? And specify random_state=N is useless becuase there is always one corner case to let me fail.

UPDATE:

There's one algorithm to solve this and its name is KShape. It can be found in tslearn github.

It clusters time-series data based on the shape of each data, so it match my needs.