% % Example 6.7 % This shows how to use the function for the whole MBC procedure. % % 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' ); %[X,midden,beachdune] = load_oronsay(0,0,0,0); [X,midden,beachdune] = load_oronsay(1,0,1,0); [X,midden,beachdune] = load_oronsay(1,0,1,1); [n,p] = size(X); data = X; truth_labels = midden; truth_type = 'midden'; % Call the model-based clustering procedure with a maximum of 6 clusters. % ... this reqires % % 9 * max_num_of_clusters % % estimates of finite mixture models % [bics,bestmodel,allmodel,Z,clabs] = mbclust(data,6); % display the dendrogram: %figure; dendrogram(Z); title('Results for Oronsay Data - MBC') % Display the BIC curves. figure; plotbic(bics); %saveas( gcf, '../../WriteUp/Graphics/Chapter6/prob_6_2_bic_curves', 'epsc' ); % We can apply the silhouette procedure for this result after we find a partition. Use 5 clusters cind = cluster(Z,'maxclust',5); figure; [S,H] = silhouette(X,cind); title('Silhouette Plot - Model-Based Agglomerative MBC') %saveas( gcf, '../../WriteUp/Graphics/Chapter6/prob_6_2_silhouette', 'epsc' ); fprintf('mean silhoutte value = %10.6f\n', mean( S ) ); fprintf('computing the NEC value\n'); out = NEC(X,allmodel); if( 0 ) figure; hold on; for mi=1:size(out,1) plot( out(mi,:) ); end else figure; plotbic(out); axis tight; title('NEC Clustering Criterion'); saveas( gcf, '../../WriteUp/Graphics/Chapter6/prob_6_11_nec', 'epsc' ); end return;