You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for j in range(5):
ksc = KShapeClusteringCPU(num_clusters, centroid_init='zero', max_iter=100, n_jobs=-1)
ksc.fit(univariate_ts_datasets)
labels = ksc.labels_ # or ksc.predict(univariate_ts_datasets)
cluster_centroids = ksc.centroids_
print(labels)
My understanding is that there's nothing random in the algo since I set the centroid init to be zero. But I get different results, e.g. sometimes the first ts and second ts belong to the same cluster and sometimes they don't
Thanks,
James
The text was updated successfully, but these errors were encountered:
Hi James,
K-Shape indeed has randomness. In your code, you set centroid init to zero, but k-Shape will randomly assign time series into clusters as an initialization. Please check here:
Also, when a cluster becomes empty during iterations, k-Shape will randomly assign a time series to that empty cluster. If you want to have a deterministic result, you need to set a random seed. I hope my answer can help.
Best,
Haojun
Hi,
Am I supposed to get different clustering result from each run on the same data set? I was running the following code:
univariate_ts_datasets = np.expand_dims(np.random.rand(200, 60), axis=2)
num_clusters = 3
CPU Model
for j in range(5):
ksc = KShapeClusteringCPU(num_clusters, centroid_init='zero', max_iter=100, n_jobs=-1)
ksc.fit(univariate_ts_datasets)
My understanding is that there's nothing random in the algo since I set the centroid init to be zero. But I get different results, e.g. sometimes the first ts and second ts belong to the same cluster and sometimes they don't
Thanks,
James
The text was updated successfully, but these errors were encountered: