mocca: Multi-objective optimization for collecting cluster...

Description Usage Arguments Value Examples

View source: R/core.R

Description

Performs a multi-objective optimization for collecting cluster alternatives. The algorithm draws R bootstrap samples from x. It calculates clusterings for all specified cluster numbers K using k-means, neuralgas, and single-linkage clustering. It then applies several cluster validation indices to the clusterings.

Usage

1
mocca(x, R = 50, K = 2:10, iter.max = 1000, nstart = 10)

Arguments

x

A numeric matrix of data, or an object that can be coerced to such a matrix (such as a numeric vector or a data frame with numeric columns).

R

The number of bootstrap samples.

K

The range of cluster numbers, i.e. a vector of integers listing the maximum numbers of clusters to be used by each of the algorithms.

iter.max

The maximum number of iterations allowed in k-means.

nstart

For k-means, how many random sets should be chosen?

Value

A list with two entries:

cluster

A list containing one sublist for each clustering algorithm and the baseline cluster solution. Each of these lists hold an entry for each cluster size K, which again consists of R vectors of cluster assignments. These vectors assign each data point in x to a cluster.

objectiveVals

A matrix of objective function values. Each row corresponds to a certain cluster validation index applied to a certain clustering algorithm. The columns correspond to different cluster numbers. Consequently, an entry of the matrix specifies the median value of a certain cluster validation index for a certain clustering algorithm with a specific number of clusters over the R bootstrap samples.

Examples

1
2
3
4
5
6
7
8
set.seed(12345)
data(toy5)
res <- mocca(toy5, R=10, K=2:5)
print(res$objectiveVals)
# plot kmeans result for MCA index against neuralgas result for MCA index
plot(res$objectiveVals[1,], res$objectiveVals[5,], pch=NA,
xlab=rownames(res$objectiveVals)[1], ylab=rownames(res$objectiveVals)[5])
text(res$objectiveVals[1,], res$objectiveVals[5,], labels=colnames(res$objectiveVals))

Example output

Loading required package: cclust
Loading required package: clv
Loading required package: cluster
Loading required package: class
generating subsets
running cluster algorithms
running evaluation
collecting objective values
                   1         2         3         4         5
kmeans.MCA        NA 1.0612245 0.8571429 0.6734694 0.5918367
kmeans.Jaccard    NA 1.0882433 0.9095287 0.7249287 0.4165825
kmeans.FM         NA 1.0916682 0.9105996 0.7503526 0.5505968
kmeans.CQS        NA 0.9907111 0.9859307 0.9262530 0.9149517
neuralgas.MCA     NA 0.9183673 0.9183673 0.7551020 0.6734694
neuralgas.Jaccard NA 0.9831312 0.9587393 0.8079859 0.6259412
neuralgas.FM      NA 0.9838706 0.9584583 0.8195493 0.6781613
neuralgas.CQS     NA 0.9910643 0.9824255 0.9464719 0.9306981
single.MCA        NA 0.9183673 0.8571429 0.8979592 0.9591837
single.Jaccard    NA 0.8114941 0.7659132 0.8798338 0.9377933
single.FM         NA 0.8284204 0.7740229 0.8530858 0.9034169
single.CQS        NA 1.0181602 1.0059204 1.0061137 1.0163270

MOCCA documentation built on March 17, 2020, 5:10 p.m.