【发布时间】:2019-03-14 21:57:48
【问题描述】:
您好,我已经获得了向量的平均值并使用 DBSCAN 对它们进行聚类。但是,我不确定应该如何绘制结果,因为我的数据没有 [x,y,z...] 格式。
样本数据集:
mean_vec = [[2.2771908044815063],
[3.0691280364990234],
[2.7700443267822266],
[2.6123080253601074],
[2.6043469309806824],
[2.6386525630950928],
[2.7034034729003906],
[2.3540258407592773]]
我使用下面的代码(来自 scikit-learn)来实现我的集群:
X = StandardScaler().fit_transform(mean_vec)
db = DBSCAN(eps = 0.15, min_samples = 5).fit(X)
core_samples_mask = np.zeros_like(db.labels_, dtype=bool)
core_samples_mask[db.core_sample_indices_] = True
labels = db.labels_
# Number of clusters in labels, ignoring noise if present.
n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)
print('Estimated number of clusters: %d' % n_clusters_)
是否可以绘制出我的集群? scikit-learn 的情节对我不起作用。 scikit-learn 链接可以找到here
【问题讨论】:
-
所以你想按照我的理解对一维向量进行聚类?
-
是的,可能有水平散点图之类的东西?
-
我认为 DBSCAN 可以通过对算法进行一些修改来处理一维数据:arxiv.org/pdf/1602.03730.pdf 您可以在这里查看一种聚类方法:stackoverflow.com/questions/35094454/… 可能,GMM 也可以工作。跨度>
标签: python scikit-learn cluster-analysis text-analysis dbscan