computeUnSupervised: Unsupervised clustering

Description Usage Arguments Details Value See Also Examples

View source: R/unsupervised.R

Description

Perform unsupervised clustering, dealing with the number of clusters K, automatically or not.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
computeUnSupervised(
  data.sample,
  K = 0,
  method.name = "K-means",
  pca = F,
  pca.nb.dims = 0,
  spec = F,
  use.sampling = FALSE,
  sampling.size.max = 0,
  scaling = F,
  RclusTool.env = initParameters(),
  echo = FALSE
)

Arguments

data.sample

list containing features, profiles and clustering results.

K

number of clusters. If K=0 (default), this number is automatically computed thanks to the Elbow method.

method.name

character vector specifying the constrained algorithm to use. Must be 'K-means' (default), 'EM' (Expectation-Maximization), 'Spectral', 'HC' (Hierarchical Clustering) or 'PAM' (Partitioning Around Medoids).

pca

boolean: if TRUE, Principal Components Analysis is applied to reduce the data space.

pca.nb.dims

number of principal components kept. If pca.nb.dims=0, this number is computed automatically.

spec

boolean: if TRUE, spectral embedding is applied to reduce the data space.

use.sampling

boolean: if FALSE (default), data sampling is not used.

sampling.size.max

numeric: maximal size of the sampling set.

scaling

boolean: if TRUE, scaling is applied.

RclusTool.env

environment in which all global parameters, raw data and results are stored.

echo

boolean: if FALSE (default), no description printed in the console.

Details

computeUnSupervised performs unsupervised clustering, dealing with the number of clusters K, automatically or not

Value

data.sample list containing features, profiles and updated clustering results (with vector of labels and clusters summaries).

See Also

computeKmeans, computeEM, spectralClustering, computePcaSample, computeSpectralEmbeddingSample

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
tf <- tempfile()
write.table(dat, tf, sep=",", dec=".")
x <- importSample(file.features=tf, dir.save=tempdir())

x <- computeUnSupervised(x, K=0, pca=TRUE, echo=TRUE)
label <- x$clustering[["K-means_pca"]]$label
plot(dat[,1], dat[,2], type = "p", xlab = "x", ylab = "y", 
col = label, main = "K-means clustering")

RclusTool documentation built on Feb. 4, 2020, 5:08 p.m.