Question

Using dbscan in package fpc I am able to get an output of:

dbscan Pts=322 MinPts=20 eps=0.005
        0   1
seed    0 233
border 87   2
total  87 235

but I need to find the cluster center (mean of cluster with most seeds). Can anyone show me how to proceed with this?

Était-ce utile?

La solution

Just index back into the original data using the cluster ID of your choice. Then you can easily do whatever further processing you want to the subset. Here is an example:

library(fpc)

n = 100
set.seed(12345)
data = matrix(rnorm(n*3), nrow=n)
data.ds = dbscan(data, 0.5)
> data.ds
dbscan Pts=100 MinPts=5 eps=0.5
        0 1 2 3
seed    0 1 3 1
border 83 4 4 4
total  83 5 7 5
> colMeans(data[data.ds$cluster==0, ])
[1]  0.28521404 -0.02804152 -0.06836167

Autres conseils

You need to understand that as DBSCAN looks for arbitrarily shaped clusters, the mean can be well outside of the cluster. Looking at means of DBSCAN clusters therefore is not really sensible.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top