Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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
       InspectecedK: [1 2 3 4 5 6]
    CriterionValues: [0.0747 0.5906 0.8737 1.0055 1.0466 0.9848]
           OptimalK: 4

Create a compact clustering evaluation object from eva.

c = compact(eva)
c = 

  GapEvaluation with properties:

    NumObservations: 150
       InspectecedK: [1 2 3 4 5 6]
    CriterionValues: [0.0747 0.5906 0.8737 1.0055 1.0466 0.9848]
           OptimalK: 4

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

Was this topic helpful?