sp.dpmeans: DP-Means Clustering for Data on Hypersphere

Description Usage Examples

View source: R/sp.dpmeans.R

Description

DP-Means Clustering for Data on Hypersphere

Usage

1
2
3
4
5
6
7
8
sp.dpmeans(
  x,
  lambda = 1,
  type = c("intrinsic", "extrinsic"),
  maxiter = 1234,
  abstol = 1e-06,
  permute.order = FALSE
)

Examples

 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
## generate two-cluster data
mymu1 = c(0,0,0,1)  # center of class 1
mymu2 = c(-1,0,0,0) # center of class 2

x1 = rvmf(50, mymu1, kappa=10)
x2 = rvmf(50, mymu2, kappa=10)
xx = rbind(x1,x2)

## apply clustering with different threshold values
case1 <- sp.dpmeans(xx, lambda=0.50)
case2 <- sp.dpmeans(xx, lambda=0.75)
case3 <- sp.dpmeans(xx, lambda=1.0)
case4 <- sp.dpmeans(xx, lambda=1.25)

## compute 2-dimensional embedding for visualization
mds2d <- sp.mds(xx, ndim=2)
mdsx  <- mds2d$embed[,1]
mdsy  <- mds2d$embed[,2]

## compare via visualization
opar  <- par(mfrow=c(2,2), pty="s")
plot(mdsx, mdsy, col=case1$cluster, main="DP lambda=0.5", pch=19)
plot(mdsx, mdsy, col=case2$cluster, main="DP lambda=1.0", pch=19)
plot(mdsx, mdsy, col=case3$cluster, main="DP lambda=1.5", pch=19)
plot(mdsx, mdsy, col=case4$cluster, main="DP lambda=2.0", pch=19)
par(opar)

kyoustat/RiemSphere documentation built on April 13, 2020, 10:04 a.m.