文本文档集的谱聚类实现
scluster的Python项目详细描述
Homepage: http://github.com/whym/scluster Contact: http://whym.org
概述
光谱聚类一种现代聚类技术,被认为是一种有效的图像聚类方法。[1][2]
该软件根据单词包表示法[3]和tf-idf加权法[4]在文档之间查找集群。
[1] | Ulrike von Luxburg, A Tutorial on Spectral Clustering, 2006. http://arxiv.org/abs/0711.0189 |
[2] | Chris H. Q. Ding, Spectral Clustering, 2004. http://ranger.uta.edu/~chqding/Spectral/ |
[3] | http://en.wikipedia.org/wiki/Bag_of_words_model |
[4] | http://en.wikipedia.org/wiki/Tf%E2%80%93idf |
要求
需要以下软件。
- python 2或3
- 努比
- scipy
如何使用
将文档准备为原始文本文件,并将其放在目录中,例如“reuters”。
准备类别文件。例如,“cats.txt”可能包含:
14833 palm-oil veg-oil 14839 ship
这意味着文件'14833'中有'palm oil'和'veg oil'作为 它的类别,和'14839'有'船舶'作为其类别。
运行:python scluster/clusterer.py cats.txt reusters/ -m kmeans,
注释
- 当你使用Reuters集合时,注意17980可能包含 第10行为非Unicode字符。它应该是这样写的:“世界 经济增长方面的措施…
[5] | http://www.daviddlewis.com/resources/testcollections/reuters21578/ |