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.

plot

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

Plot clustering evaluation object criterion values

Syntax

plot(eva)
h = plot(eva)

Description

plot(eva) displays a plot of the criterion values versus the number of clusters, based on the values stored in the clustering evaluation object eva.

h = plot(eva) returns a handle to the plot line.

Input Arguments

expand all

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

Output Arguments

expand all

Handle to the plot line, returned as a scalar value.

Examples

expand all

Plot the criterion values versus the number of clusters for each clustering solution stored in a 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 Calinski-Harabasz criterion.

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

Plot the Calinski-Harabasz criterion values for each number of clusters tested.

figure;
plot(eva);

The plot shows that the highest Calinski-Harabasz value occurs at three clusters, suggesting that the optimal number of clusters is three.

See Also

Was this topic helpful?