GapEvaluation
statistics: GapEvaluation
Gap evaluation for clustering solutions
The GapEvaluation class implements the gap statistic criterion for
evaluating clustering solutions. A GapEvaluation object is a
specialization of ClusterCriterion and contains fields and methods
to compute the gap statistic, its Monte-Carlo reference expectations, and
to select the optimal number of clusters according to a chosen search
method.
Create a GapEvaluation object by using the evalclusters
function or by calling the class constructor directly.
See also: evalclusters, ClusterCriterion, CalinskiHarabaszEvaluation, DaviesBouldinEvaluation, SilhouetteEvaluation
Source Code: GapEvaluation
The GapEvaluation class contains the following properties:
A positive integer specifying how many reference datasets are generated to compute the expected log within-cluster dispersion via Monte-Carlo simulation. This property is read-only.
A character vector or function handle specifying the distance measure
passed to clustering routines (as accepted by pdist). When a
numeric vector is supplied it is interpreted as a precomputed distance
vector. This property is read-only.
A character vector naming the reference distribution used to generate
reference datasets. Supported values include 'pca' and
'uniform'. This property is read-only.
A character vector specifying the method used to select the optimal
number of clusters from the gap statistic. Supported values include
'globalMaxSE' and 'firstMaxSE'. This property is
read-only.
A numeric vector containing the Monte-Carlo estimate of the expected values for the natural logarithm of the within-cluster dispersion, computed across the generated reference datasets. This property is read-only.
A numeric vector containing the observed values of the natural logarithm of the within-cluster dispersion computed on the actual data. This property is read-only.
A numeric vector containing the standard error of the expected values for the natural logarithm of the within-cluster dispersion. This property is read-only.
A numeric vector containing the standard deviation of the Monte-Carlo estimates of the log within-cluster dispersion. This property is read-only.
A character vector or a function handle specifying the clustering algorithm used to generate the clustering solutions. It can be empty if the clustering solutions are passed as an input matrix. This property is read-only.
A character vector specifying the name of the criterion used to evaluate the clustering solutions. This property is read-only.
A numeric vector containing the values generated by the evaluation criterion for each clustering solution. This property is read-only.
A numeric vector containing the list of the number of clusters evaluated. This property is read-only.
A logical vector indicating which observations in the data matrix contain
missing values (NaN). This property is read-only.
An integer specifying the number of non-missing observations in the data matrix. This property is read-only.
An integer specifying the optimal number of clusters based on the evaluation criterion. This property is read-only.
A numeric vector representing the clustering solution that corresponds to the optimal number of clusters. This property is read-only.
A numeric matrix containing the data used for clustering. This property is read-only.
The GapEvaluation class offers the following public methods:
statistics: obj = GapEvaluation (x, clust, KList)
statistics: obj = GapEvaluation (x, clust, KList, B)
statistics: obj = GapEvaluation (…, name, value)
obj = GapEvaluation (x, clust, KList)
returns a GapEvaluation object configured to evaluate the
clustering function specified by clust on the data matrix
x for the list of cluster counts in KList.
Optional inputs:
B - Number of reference datasets to generate (default 100).
'Distance' - Distance metric name or function handle as
accepted by pdist (default 'sqeuclidean').
'ReferenceDistribution' - Reference distribution to use
(default 'pca'; 'uniform' is supported).
'SearchMethod' - Method to select the optimal K; one of
'globalMaxSE' or 'firstMaxSE' (default
'globalMaxSE').
See also: evalclusters, ClusterCriterion
GapEvaluation: obj = addK (obj, K)
Add a new cluster array to inspect in the GapEvaluation object.
This updates internal storage for Monte-Carlo results and evaluates the
newly requested cluster counts.
GapEvaluation: plot (obj)
GapEvaluation: h = plot (obj)
Plot the gap statistic (criterion values) versus the inspected numbers of clusters and display error bars representing the Monte-Carlo standard deviations. Optionally returns the axes handle.