Help documentation-Translation-statistics toolbox-exploratory Data analysis-cluster analysis-hierarchical Clustering (linkage) (6)

Source: Internet
Author: User

Example

Compare Cluster Assignments to Clusters

Import the sample data.

Load Fisheriris

From the Anderson Iris Floral Data set, the ward linkage calculates four clusters and ignores the type information.

Z = Linkage (MEAs, ' Ward ', ' Euclidean ');

c = Cluster (Z, ' Maxclust ', 4);

The relationship between cluster results and three species was observed.

Crosstab (c,species)

Print the first 5 lines of Z.

firstfive = Z (1:5,:)

Generates a system tree graph of Z.

Dendrogram (Z)

Clustering the data and plotting the results

Randomly generate sample data for 20,000 observation points.

RNG (' default ')% for reproducibility

X = rand (20000,3);

Use Ward's linkage to generate a hierarchical tree.

Z = Linkage (X, ' Ward ', ' Euclidean ', ' savememory ', ' on ');

If you set savememory to ' off ', you will receive a memory overflow error if your computer does not have enough memory to hold the distance matrix.

Cluster data into 4 groups and print the results.

c = Cluster (Z, ' Maxclust ', 4);

Scatter3 (X (:, 1), X (:, 2), X (:, 3), 10,c)

Help documentation-Translation-statistics toolbox-exploratory Data analysis-cluster analysis-hierarchical Clustering (linkage) (6)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.