如何查看ELKI DBSCAN聚类结果

时间:2014-05-21 12:47:13

标签: cluster-analysis data-mining dbscan elki

我正在使用ELKI进行大约14,000个GPS点的DBSCAN聚类。它运行正常,但我希望看到有关群集的信息,例如群集中有多少点。?

2 个答案:

答案 0 :(得分:1)

如果您使用-resulthandler ResultWriter并输出到文本,则群集大小将位于每个群集文件的顶部。

可视化工具目前似乎无法显示群集大小。

答案 1 :(得分:0)

如果使用-resulthandler ResultWriter并输出到文本,则群集大小将位于每个群集文件的顶部。

此外,如果您想将所有这些结果合并到一个文件中,这里有一个有效的python脚本:

clusterout_path = "path/to/where/files/all/go/"
finalout_path = "/path/for/single/merged/file/"
consol_filename= "single_merged_file.txt"

cll_file = open(finalout_path + consol_filename,"a")
cll_file.write("ClusterID"+ "\t" + "Lon" + "\t" + "Lat" + "\n")
def readFile(file):
    f = open(clusterout_path + file)
    counter = 0
    cluster = ""
    lon = ""
    lat = ""
    for line in f.readlines():
        counter+=1
        if counter == 1:
            cluster = line.split(":")[1].strip().lower()

        if counter > 4 and line.startswith("ID"):
            arr = line.split(" ")
            lon = arr[1]
            lat = arr[2]
            cll_file.write(cluster + "\t" + lon + "\t" + lat + "\n") 
    f.close()

listing = os.listdir(clusterout_path)
for infile in listing:
    print "Processing file: " + infile
    readFile(infile) 

cll_file.close()