Categories &

Functions List

Class Definition: SilhouetteEvaluation

statistics: SilhouetteEvaluation

Silhouette evaluation for clustering

The SilhouetteEvaluation class implements an object to evaluate clustering solutions using the silhouette criterion. A SilhouetteEvaluation object is a ClusterCriterion object that computes silhouette values for clustering solutions and selects the best number of clusters as the one with the highest average silhouette value.

Create a SilhouetteEvaluation object by using the evalclusters function or the class constructor.

List of public properties specific to SilhouetteEvaluation:

Distance
A valid distance metric name (string), a function handle, or a numeric vector as returned by pdist. This specifies how pairwise distances are computed.
ClusterPriors
A character vector specifying how to evaluate silhouette values across clusters: 'empirical' (default) uses empirical cluster priors, or 'equal' treats clusters equally.
ClusterSilhouettes
A cell array containing silhouette values for each observation for each inspected cluster number.

The best clustering solution according to the silhouette criterion is the one that yields the highest average silhouette value.

See also: evalclusters, ClusterCriterion, CalinskiHarabaszEvaluation, DaviesBouldinEvaluation, GapEvaluation

Source Code: SilhouetteEvaluation

The SilhouetteEvaluation class contains the following properties:

A string naming a distance metric, a function handle that computes distances, or a numeric vector as produced by pdist. This property is read-only.

Specifies how cluster-level silhouette aggregation is computed. Valid values are 'empirical' (default) and 'equal'. This property is read-only.

A cell array where each element holds the mean silhouette value of each cluster of a given clustering (corresponding to an inspected K), so element i is a vector of InspectedK(i) values. 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 SilhouetteEvaluation class offers the following public methods:

statistics: obj = SilhouetteEvaluation (x, clust, KList)
statistics: obj = SilhouetteEvaluation (…, Name, Value)

  • x is an N×P numeric matrix of observations (rows) and predictors (columns).
  • clust is a string naming the clustering method (for example 'kmeans', 'linkage', or a custom function handle).
  • KList is a vector of positive integers specifying the cluster numbers to inspect.

Optional name-value pairs:

NameValue
'Distance'Distance metric name, function handle, or numeric pdist vector. Default: 'sqeuclidean'.
'ClusterPriors'Either 'empirical' (default) or 'equal'.

See also: silhouette, evalclusters, ClusterCriterion

SilhouetteEvaluation: obj = addK (obj, K)

SilhouetteEvaluation: plot (obj)
SilhouetteEvaluation: h = plot (obj)

Plot the criterion values (average silhouette) against inspected cluster numbers (InspectedK) for the given obj. Optionally returns the axis handle for the plot.