Learn R Programming

clue (version 0.1-0)

ensemble: Cluster Ensembles

Description

Creation and manipulation of cluster ensembles.

Usage

cl_ensemble(..., list = NULL)
as.cl_ensemble(x)
is.cl_ensemble(x)

Arguments

...
R objects representing clusterings of the same kind (either all partitions or all hierarchies) on the same objects.
list
a list of R objects as in ....
x
for as.cl_ensemble, an R object as in ...; for is.cl_ensemble, an arbitrary R object.

Value

  • cl_ensemble returns a list of the given clusterings, with additional class information (see Details).

Details

cl_ensemble creates cluster ensembles, which are realized as lists of clusterings with additional class information. All clusterings in an ensemble must be of the same kind, and have the same number of objects. If all clusterings are partitions, this list has class "cl_partition_ensemble" and inherits from "cl_ensemble"; if all clusterings are hierarchies, it has class "cl_hierarchy_ensemble" and inherits from "cl_ensemble". Empty ensembles cannot be categorized according to the kind of clusterings they contain, and hence only have class "cl_ensemble".

The list representation makes it possible to use lapply for computations on the individual clusterings in (i.e., the components of) a cluster ensemble.

Available methods for cluster ensembles include those for subscripting, c, rep, and print.

Note that (currently), as.cl_ensemble assumes that unclassed lists represent single clusterings, as this in particular holds true for kmeans in versions of R prior to 2.1.0. This may change eventually.

Examples

Run this code
d <- dist(USArrests)
hclust_methods <- c("ward", "single", "complete", "average",
                    "mcquitty", "median", "centroid")
hclust_results <- lapply(hclust_methods, function(m) hclust(d, m))
## Now create an ensemble from the results.
hens <- cl_ensemble(list = hclust_results)
names(hens) <- hclust_methods 
hens
## Subscripting.
hens[1 : 3]
## Replication.
rep(hens, 3)
## And continue to analyze the ensemble, e.g.
cl_dissimilarity(hens, method = "gamma")

Run the code above in your browser using DataLab