计算DTW指标的轮廓分数

时间:2019-07-16 11:36:04

标签: python cluster-computing silhouette dtw

我有一些时间序列数据,我想使用DTW指标对其进行聚类。 首先,我需要为其计算轮廓分数。 我使用以下代码来计算不同数量的簇的轮廓分数:

 for n_cluster in n_cluster_list:
     dtw = TimeSeriesKMeans(n_clusters = n_cluster, metric="dtw")
     cluster_found = dtw.fit_predict(X) #in X I have my data
     silhouette_score(X, dtw.labels_, metric="dtw"))

但这对我不起作用。 我收到此错误:

ValueError: Unknown metric dtw. Valid metrics are ['euclidean', 
'l2', 'l1', 'manhattan', 'cityblock', 'braycurtis', 'canberra',         
'chebyshev', 'correlation', 'cosine', 'dice', 'hamming', 'jaccard', 
'kulsinski', 'mahalanobis', 'matching', 'minkowski', 
'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 
'sokalsneath', 'sqeuclidean', 'yule', 'wminkowski', 'haversine'], 
or 'precomputed', or a callable

我在这里找到了代码:https://tslearn.readthedocs.io/en/latest/gen_modules/clustering/tslearn.clustering.silhouette_score.html

有人知道这里的问题吗?

0 个答案:

没有答案
相关问题