DATA MINING with MATLAB by Marvin L

DATA MINING with MATLAB by Marvin L

Author:Marvin L. [L., Marvin]
Language: eng
Format: epub
Publisher: UNKNOWN
Published: 2016-10-22T23:00:00+00:00


Assign New Data to Clusters

In the previous example, fitting the mixture distribution to data using fit, and clustering those data using cluster, are separate steps. However, the same data are used in both steps. You can also use the cluster method to assign new data points to the clusters (mixture components) found in the original data.

1 Givenadataset X, first fit a Gaussian mixture distribution. The previous code has already done that.

gm

gm =

Gaussian mixture distribution with 2 components in 2 dimensions Component 1: Mixing proportion: 0.312592 Mean: -0.9082 -2.1109

Component 2:

Mixing proportion: 0.687408 Mean: 0.9532 1.8940

2 You can then use cluster to assign each point in a new data set, Y,toone of the clusters defined for the original data:

Y = [mvnrnd(mu1,sigma1,50);mvnrnd(mu2,sigma2,25)];

idx = cluster(gm,Y); cluster1 = (idx == 1); cluster2 = (idx == 2);

scatter(Y(cluster1,1),Y(cluster1,2),10,'r+'); hold on

scatter(Y(cluster2,1),Y(cluster2,2),10,'bo'); hold off

legend('Class 1','Class 2','Location','NW')



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.