%% Template file for Iris Data Clustering %Load the data: load IrisNoLabel [mm,nn]=size(X); % X is number of points by dimension- in this case, 150 x 4 % Initialize the clusters as matrix C, 10 x 4 (Using random data points) % Run the LBG Update algorithm 10 times (shouldn't need to change this): for j=1:10 [P,C,Err]=lbgUpdate(X,C); end %Plot the data and the clusters in the first two dimensions (No changes %here): figure(1) plot(X(idx1,1),X(idx1,2),'k.',X(idx2,1),X(idx2,2),'k*',X(idx3,1),X(idx3,2),'k^'); hold on plot(C(:,1),C(:,2),'rs'); hold off %% Visualize the Data % Here, we want to visualize the data and the cluster centers using the % best basis. Find the best basis for the data, and project both the data % and the cluster centers to the best plane. End result should be two % matrices, CoordsX (150 x 2) and CoordsC (10 x 2): % Plotting routines- Should not need to change anything here: figure(2) voronoi(CoordsC(:,1),CoordsC(:,2)); hold on plot(CoordsC(:,1),CoordsC(:,2),'rs'); plot(CoordsX(idx1,1),CoordsX(idx1,2),'k.',CoordsX(idx2,1),CoordsX(idx2,2),'k*',CoordsX(idx3,1),CoordsX(idx3,2),'k^'); hold off % Comment on how well the clustering did: