【发布时间】:2016-07-28 00:27:41
【问题描述】:
我目前正在使用 NTSB 航空事故数据库进行一些分析。该数据集中的大多数航空事故都有原因陈述,描述了导致此类事件的因素。
我在这里的一个目标是尝试对原因进行分组,而聚类似乎是解决此类问题的可行方法。在开始 k-means 聚类之前,我执行了以下操作:
- 停用词去除,即去除文本中一些常用的功能词
- 文本词干提取,即去除单词的后缀,必要时将术语转换为最简单的形式
- 将文档向量化为 TF-IDF 向量,以放大不太常见但信息量更大的单词,并缩小高度常见但信息量较少的单词
- 应用SVD降低向量的维数
在这些步骤之后,k-means 聚类被应用于向量。通过使用从 1985 年 1 月到 1990 年 12 月发生的事件,我得到以下结果,其中包含 k = 3 的集群数:
(注意:我正在使用 Python 和 sklearn 进行分析)
... some output omitted ...
Clustering sparse data with KMeans(copy_x=True, init='k-means++', max_iter=100, n_clusters=3, n_init=1,
n_jobs=1, precompute_distances='auto', random_state=None, tol=0.0001,
verbose=True)
Initialization complete
Iteration 0, inertia 8449.657
Iteration 1, inertia 4640.331
Iteration 2, inertia 4590.204
Iteration 3, inertia 4562.378
Iteration 4, inertia 4554.392
Iteration 5, inertia 4548.837
Iteration 6, inertia 4541.422
Iteration 7, inertia 4538.966
Iteration 8, inertia 4538.545
Iteration 9, inertia 4538.392
Iteration 10, inertia 4538.328
Iteration 11, inertia 4538.310
Iteration 12, inertia 4538.290
Iteration 13, inertia 4538.280
Iteration 14, inertia 4538.275
Iteration 15, inertia 4538.271
Converged at iteration 15
Silhouette Coefficient: 0.037
Top terms per cluster:
**Cluster 0: fuel engin power loss undetermin exhaust reason failur pilot land**
**Cluster 1: pilot failur factor land condit improp accid flight contribute inadequ**
**Cluster 2: control maintain pilot failur direct aircraft airspe stall land adequ**
我生成了如下数据的绘图图:
结果对我来说似乎没有意义。我想知道为什么所有的集群都包含一些常见的术语,比如“pilot”和“failure”。
我能想到的一种可能性(但我不确定它在这种情况下是否有效)是具有这些常用术语的文档实际上位于绘图图的中心,因此它们不能有效地聚集成一个正确的簇。我相信这个问题不能通过增加集群的数量来解决,因为我刚刚这样做了,这个问题仍然存在。
我只是想知道是否还有其他因素可能导致我面临的情况?或者更广泛地说,我是否使用了正确的聚类算法?
谢谢。
【问题讨论】:
-
Or more broadly, am I using the right clustering algorithm- 反问:如果有人要求您写下 k-means 聚类对数据所做的假设。你知道该怎么回答吗?
标签: machine-learning scikit-learn cluster-analysis k-means data-science