約 14,000 個の GPS ポイントの DBSCAN クラスタリングに ELKI を使用しています。正常に動作していますが、クラスター内のポイント数などのクラスターに関する情報を確認したいです。
2 に答える
0
-resulthandler ResultWriter を使用してテキストに出力する場合、クラスター サイズは各クラスター ファイルの先頭になります。
また、これらすべての結果を 1 つのファイルにマージする場合は、次の 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 に答える