Cluster Data
Description
The Cluster Data Live Editor Task enables you to interactively perform k-means clustering. The task generates MATLAB® code for your live script and returns the resulting cluster indices and the cluster centroid locations to the MATLAB workspace.
You can:
Determine the optimal number of clusters for your data manually by selecting the number of clusters or automatically by specifying criteria such as gap values, silhouette values, Davies-Bouldin index values, and Calinski-Harabasz index values.
Customize the parameters for clustering your data, including the distance metric and the number of replicates.
Automatically visualize the clustered data.
For general information about Live Editor tasks, see Add Interactive Tasks to a Live Script.
Open the Task
To add the Cluster Data task to a live script:
On the Live Editor tab, select Task > Cluster Data.
In a code block in the live script, type a relevant keyword, such as
clustering
orkmeans
. Select Cluster Data from the suggested command completions.
Parameters
Tips
By default, the Cluster Data task does not automatically run when you modify the task parameters. To have the task run automatically after any change, select the autorun
button at the top-right of the task. If your dataset is large, do not enable this option.
Version History
Introduced in R2021b