PAC: Partition Assisted Clustering PAC 1) utilizes dsp or bsp-ll...

Description Usage Arguments Value Examples

View source: R/PAC.R

Description

Partition Assisted Clustering PAC 1) utilizes dsp or bsp-ll to recursively partition the data space and 2) applies a short round of kmeans style postprocessing to efficiently output clustered labels of data points.

Usage

1
PAC(data, K, maxlevel = 40, method = "dsp", max.iter = 50)

Arguments

data

a n x p data matrix

K

number of final clusters in the output

maxlevel

the maximum level of the partition

method

partition method, either "dsp(discrepancy based partition)", or "bsp(bayesian sequantial partition)"

max.iter

maximum iteration for the kmeans step

Value

y cluter labels for the input

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
n = 5e3                       # number of observations
p = 1                         # number of dimensions
K = 3                         # number of clusters
w = rep(1,K)/K                # component weights
mu <- c(0,2,4)                # component means
sd <- rep(1,K)/K              # component standard deviations
g <- sample(1:K,prob=w,size=n,replace=TRUE)   # ground truth for clustering
X <- as.matrix(rnorm(n=n,mean=mu[g],sd=sd[g]))
y <- PAC(X, K)
print(fmeasure(g,y))

Example output

Input Data: 5000 by 1
Partition method: Discrepancy based partition
Maximum level: 40
partition completed
[1] "Initial Clustering..."
[1] "Merging..."
[1] 0.9964212

PAC documentation built on Feb. 18, 2021, 9:06 a.m.