compact

Class: clustering.evaluation.ClusterCriterion
Package: clustering.evaluation

Compact clustering evaluation object

Syntax

c = compact(eva)

Description

c = compact(eva) returns a compact clustering evaluation object, which contains a subset of information about the clustering solution in eva. Compacting a clustering evaluation object reduces the memory requirements of the object, which is useful when clustering a large data set.

Input Arguments

expand all

Clustering evaluation data, specified as a clustering evaluation object. Create a clustering evaluation object using evalclusters.

Output Arguments

expand all

Compact clustering evaluation object, returned as a clustering evaluation object. The compact object includes the clustering evaluation results, In the compact object, the properties for the input data X, optimal clustering solution OptimalY, and the list of excluded data Missing are empty.

Examples

expand all

Create a compact clustering evaluation object from a full clustering evaluation object.

Load the sample data.

load fisheriris;

The data contains length and width measurements from the sepals and petals of three species of iris flowers.

Create a clustering evaluation object. Cluster the data using kmeans, and evaluate the optimal number of clusters using the gap criterion.

rng('default');  % For reproducibility
eva = evalclusters(meas,'kmeans','Gap','KList',[1:6])
eva = 
  GapEvaluation with properties:

    NumObservations: 150
         InspectedK: [1 2 3 4 5 6]
    CriterionValues: [0.0720 0.5928 0.8762 1.0114 1.0534 1.0720]
           OptimalK: 5

Create a compact clustering evaluation object from eva.

c = compact(eva)
c = 
  GapEvaluation with properties:

    NumObservations: 150
         InspectedK: [1 2 3 4 5 6]
    CriterionValues: [0.0720 0.5928 0.8762 1.0114 1.0534 1.0720]
           OptimalK: 5

The displayed output of the compact object c is the same as the original object eva, but some properties not shown in the display are different. For example, in the compact object, the properties x, OptimalY, and Missing are empty.

Display the optimal clustering solution OptimalY for c.

c.OptimalY
ans =

     []

See Also