Help documentation-Translation-statistics toolbox-exploratory Data analysis-cluster analysis-hierarchical Clustering (cluster,clusterdata) ( 2)

Source: Internet
Author: User

Example

Generating hierarchical cluster trees from sample data

This example shows the use of sample data to generate hierarchical clusters, and a 3-D scatter plot to present the cluster.

Produces the sample data matrix, where the random number is generated by the standard uniform distribution (U (0,1)).

RNG (' Default '); % for Reproducibilty

X = [Gallery (' Uniformdata ', [10 3],12);

Gallery (' Uniformdata ', [10 3],13) +1.2;

Gallery (' Uniformdata ', [10 3],14) +2.5];

Calculates the distance between elements and generates a hierarchical number of clusters from the sample data. Lists all the elements in the second cluster.

T = Clusterdata (X, ' Maxclust ', 3);

Find (T = = 2)

Ans =

11 12 13 14 15 16 17 18 19 20

Plot the data into a graphic, where each category corresponds to a different color.

Scatter3 (X (:, 1), X (:, 2), X (:, 3), 100,t, ' filled ')

Generating hierarchical cluster trees using Ward's linkage

This example shows the use of Ward's linkage to generate hierarchical clustering numbers, and a 3-D scatter plot to present the cluster.

Produces a sample data matrix of 20,000 rows and 3 columns, where the random number is generated by the standard uniform distribution (U (0,1)).

RNG (' Default '); % for Reproducibilty

X = rand (20000,3);

Use Ward's linkage to generate hierarchical clustering trees. Set ' savememory ' to ' on ' to construct the cluster but not to calculate the distance matrix.

c = Clusterdata (X, ' linkage ', ' ward ', ' savememory ', ' on ', ' Maxclust ', 4);

Plot the data into a graphic, where each category corresponds to a different color.

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

Help documentation-Translation-statistics toolbox-exploratory Data analysis-cluster analysis-hierarchical Clustering (cluster,clusterdata) ( 2)

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.