% % An exension of Example 6.8 % % Written by: % -- % John L. Weatherwax 2005-08-14 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- close all; drawnow; clc; clear; addpath( '../../Code/eda_data' ); addpath( '../../Code/eda_toolbox' ); addpath( '../Chapter1' ); % Uses the results from the previous example or Example 6.7, which % shows how to use the function for the whole MBC procedure. load iris data = [setosa;versicolor;virginica]; % Call the model-based clustering procedure with a maximum of 6 clusters. [bics,bestmodel,allmodel,Z,clabs] = mbclust(data,6); % Display the BIC curves. plotbic(bics) % Display the agglomerative part in the % One can use the clabs information along with gplotmatrix % to do a grouped scatterplot matrix of the data. Do the groups seem % reasonable? % To extract model 9, *2* clusters, we use the following: allmodel(9).clus(2) % Extract the data: pies = allmodel(9).clus(2).pies; mus = allmodel(9).clus(2).mus; vars = allmodel(9).clus(2).vars; % The mixclass function returns group labels % as well as a measure of the uncertainty in % classificaiton. [clabs2,unc] = mixclass(data,pies,mus,vars); % As before, we can use the silhouette procedure to assess the cluster results. figure; [S, H] = silhouette(data,clabs2); title('Iris Data - Model-Based Clustering')