【问题标题】:How to retrieve the original data points that belong to every cluster from dbscan algorithm using R如何使用 R 从 dbscan 算法中检索属于每个集群的原始数据点
【发布时间】:2018-04-22 20:06:19
【问题描述】:

我正在使用library("dbscan") 对具有纬度和经度的地理数据进行聚类。我想知道哪些坐标[纬度,经度]属于R中的哪个集群。有没有办法检索每个集群下的原始数据点? 示例:

纬度=c(60.95886,63.04287,60.79435,61.79435,64.79435,61.95886,65.04287,66.79435,63.79435,65.79435,66.79435,68.79435,69.794)5)

经度 = c(27.79045,22.87444,24.51007, 23.49429, 23.49429, 28.79045,23.87444,26.51007, 25.49429, 26.49429,26.49429, 29.49429,30.49)

testData = data.frame(纬度,经度)

clust

集群

DBSCAN clustering for 13 objects.
Parameters: eps = 1.5, minPts = 3
The clustering contains 2 cluster(s) and 7 noise points.

0 1 2 
7 3 3 

这里我想知道 testData 中属于集群 1 和 2 的数据点

【问题讨论】:

标签: r


【解决方案1】:

将 dbscan 的输出添加到您的初始 data.frame。

testData$cluster = clust$cluster

【讨论】:

    猜你喜欢
    • 2020-10-07
    • 1970-01-01
    • 2015-07-21
    • 2013-05-13
    • 2023-03-23
    • 2019-08-31
    • 1970-01-01
    • 2014-03-26
    • 2021-04-19
    相关资源
    最近更新 更多