我正在使用 ELKI 对大约 14,000 个 GPS 点进行 DBSCAN 聚类。它运行良好,但我想查看有关集群的信息,例如集群中有多少点。?
问问题
472 次
2 回答
1
如果您使用-resulthandler ResultWriter
and 输出到文本,则簇大小将位于每个簇文件的顶部。
可视化工具目前似乎没有显示集群大小。
于 2014-05-21T18:37:47.917 回答
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()
于 2015-09-24T16:51:34.357 回答