Description Usage Arguments Value References See Also Examples
View source: R/rclust.dbscan.R
Density-Based Spatial Clustering of Applications with Noise (DBSCAN) is a generally applicable clustering algorithm
as long as we have concept of dissimilarity. We adopt dbscan
algorithm
by dbscan package. See dbscan
for more details.
1 | rclust.dbscan(input, type = c("extrinsic", "intrinsic"), eps, minPts = 5, ...)
|
input |
a S3 object of |
type |
type of distance, either |
eps |
size of the epsilon neighborhood. |
minPts |
number of minimum points in the eps region (for core points). Default is 5 points. |
... |
extra parameters for DBSCAN algorithms including |
an object of class dbscan_fast
containing
value of the eps parameter.
value of the minPts parameter.
An integer vector with cluster assignments. Zero indicates noise points.
ester_density-based_1996RiemBaseExt
\insertRefhahsler_dbscan_2019RiemBaseExt
See dbscan
for details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ## generate 50 points near (0,0,1) and
## 50 points near (0,0,-1) on Sphere S^2
ndata = 50
theta = seq(from=-0.99,to=0.99,length.out=ndata)*pi
tmpx = cos(theta) + rnorm(ndata,sd=0.1)
tmpy = sin(theta) + rnorm(ndata,sd=0.1)
## wrap it as 'riemdata' class
data = list()
for (i in 1:ndata){
tgt = c(tmpx[i],tmpy[i],1)
data[[i]] = tgt/sqrt(sum(tgt^2)) # project onto Sphere
}
for (i in 1:ndata){
tgt = c(tmpx[i],tmpy[i],-1)
data[[i+ndata]] = tgt/sqrt(sum(tgt^2)) # project onto Sphere
}
data = RiemBase::riemfactory(data, name="sphere")
## compare extrinsic and intrinsic DBSCAN
dbext <- rclust.dbscan(data, eps=0.5, type="extrinsic")
dbint <- rclust.dbscan(data, eps=0.5, type="intrinsic")
## let's visualize the results via MDS in R^2
pdist = stats::as.dist(RiemBase::rbase.pdist(data))
dat2d = stats::cmdscale(pdist, k=2)
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,2))
plot(dat2d[,1], dat2d[,2], col=dbext$cluster, pch=19, main="extrinsic+dbscan")
plot(dat2d[,1], dat2d[,2], col=dbint$cluster, pch=19, main="intrinsic+dbscan")
par(opar)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.