船舶位置数据集上DBSCAN聚类结果异常问题排查
船舶坐标DBSCAN聚类异常点问题
数据集与聚类代码
数据集包含约10000个船舶坐标点,存储于86b44fe9.txt文件中,当前使用DBSCAN进行聚类的代码如下:
from sklearn.cluster import DBSCAN file = open("86b44fe9.txt", "r") lines = file.readlines() x = [] for p in lines: poi = p.rstrip("\n").split(" ") x.append([float(poi[2]), float(poi[3])]) # DBSCAN参数设置 min_samples = 42 eps = 0.001 dbscan = DBSCAN(eps, min_samples).fit(x) # 拟合聚类模型 labels = dbscan.labels_ out_file = open("clusters.txt", "w") for p in range(len(lines)): poi = lines[p].rstrip("\n").split(" ") out_file.write(poi[0] + " ") out_file.write(poi[1] + " ") out_file.write(str(labels[p])) out_file.write("\n") out_file.close()
异常问题说明
聚类结果中出现大量黄色异常点,其中红框标注的点(如ID为10248558的点)不符合预期。曾考虑是否因使用欧氏距离而非Haversine距离导致该问题,但目前暂不认为是此原因。

内容的提问来源于stack exchange,提问作者banbar
相关产品推荐
相关产品推荐

