聚类性能评估(Davies-Bouldin索引)错误
我正在尝试使用各种聚类性能评估方法弄清楚簇数量。我将数据放在循环中,然后ran dba k均值。我正在获得肘部和轮廓结果,但邓恩指数显示出错误。以下是代码:
inertias = []
silhouette = []
davies_bouldin = []
clusters_range = range(1, 10)
for K in clusters_range:
dba_km = TimeSeriesKMeans(n_clusters=K,
n_init=2,
metric="dtw",
verbose=True,
max_iter_barycenter=10,
random_state=seed)
y_pred = dba_km.fit_predict(scaled_ts)
inertias.append(dba_km.inertia_)
if K > 1:
silhouette.append(silhouette_score(scaled_ts, dba_km.labels_))
davies_bouldin.append(davies_bouldin_score(scaled_ts, dba_km.labels_))
错误在davies_bouldin.append
line上显示:
TypeError: 'list' object is not callable.
I am trying to figure out the optimum number of clusters using various clustering performance evaluation methods. I put my data through a loop and ran DBA k-means. I am getting the elbow and silhouette results but the dunn index is showing error. Below is the code:
inertias = []
silhouette = []
davies_bouldin = []
clusters_range = range(1, 10)
for K in clusters_range:
dba_km = TimeSeriesKMeans(n_clusters=K,
n_init=2,
metric="dtw",
verbose=True,
max_iter_barycenter=10,
random_state=seed)
y_pred = dba_km.fit_predict(scaled_ts)
inertias.append(dba_km.inertia_)
if K > 1:
silhouette.append(silhouette_score(scaled_ts, dba_km.labels_))
davies_bouldin.append(davies_bouldin_score(scaled_ts, dba_km.labels_))
The error is showing on the davies_bouldin.append
line:
TypeError: 'list' object is not callable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我在这里的第一篇文章:我仍然是Python的业余爱好者,所以我来这里寻找一些答案并找到了您的帖子。事实证明,我已经使用您的代码做类似的操作,只需进行几次小调调整,并且效果很好!让我向您展示我的改编:
PS。不确定何时发布此内容,但希望伸出援手不会晚。干杯!
this is my first post here: I'm still quite an amateur in python, so I came here looking for some answers myself and found your post. Turns out I've used your code to do something similar, with just a couple of minor adjustments and it worked perfectly! let me show you my adaptation:
Ps. Not sure when you posted this one, but hope it's not to late to give a hand. Cheers!