% a warmup makeup exercise for you Assignment1 % makeup dataset in 2D x = [1 1; 1 2; 2 1; -1 -1; -1 -2]; plot(x(:,1), x(:,2), 'kx') %plots the points axis ([-3 3 -3 3]) text (x(:,1) +.1, x(:,2)+.1, '1|2|3|4|5'); %adds labels to points % How many clusters can you visually see? %find the Euclidean distance using pdist ye = pdist(x, 'euclid'); % put distances in a matrix form ye_mat = squareform(ye); % You may wish to display this matrix to visually display % Note that this matrix is square and symmetric % read about a few other metric for distance calculation such as cityblock ycb = pdist (x , 'cityblock'); ycb_mat = squareform (ycb); zsingle = linkage (ye, 'single'); zcomplete = linkage (ye, 'complete'); dendrogram(zsingle) title ('clustering single linkage') dendrogram(zcomplete) title ('clustering complete linkage')