Hi I was wondering when you cluster data on the figure screen is there a way to show which rows the data points belong to when you scroll over them?
From the picture above I was hoping there would be a way in which if I select or scroll over the points that I could tell which row it belonged to.
Here is the code:
%% dimensionality reduction columns = 6 [U,S,V]=svds(fulldata,columns); %% randomly select dataset rows = 1000; columns = 6; %# pick random rows indX = randperm( size(fulldata,1) ); indX = indX(1:rows); %# pick random columns indY = randperm( size(fulldata,2) ); indY = indY(1:columns); %# filter data data = U(indX,indY); %% apply normalization method to every cell data = data./repmat(sqrt(sum(data.^2)),size(data,1),1); %% generate sample data K = 6; numObservarations = 1000; dimensions = 6; %% cluster opts = statset('MaxIter', 100, 'Display', 'iter'); [clustIDX, clusters, interClustSum, Dist] = kmeans(data, K, 'options',opts, ... 'distance','sqEuclidean', 'EmptyAction','singleton', 'replicates',3); %% plot data+clusters figure, hold on scatter3(data(:,1),data(:,2),data(:,3), 5, clustIDX, 'filled') scatter3(clusters(:,1),clusters(:,2),clusters(:,3), 100, (1:K)', 'filled') hold off, xlabel('x'), ylabel('y'), zlabel('z') %% plot clusters quality figure [silh,h] = silhouette(data, clustIDX); avrgScore = mean(silh); %% Assign data to clusters % calculate distance (squared) of all instances to each cluster centroid D = zeros(numObservarations, K); % init distances for k=1:K %d = sum((x-y).^2).^0.5 D(:,k) = sum( ((data - repmat(clusters(k,:),numObservarations,1)).^2), 2); end % find for all instances the cluster closet to it [minDists, clusterIndices] = min(D, [], 2); % compare it with what you expect it to be sum(clusterIndices == clustIDX)
Or possibly an output method of the clusters data, normalized and re-organized to there original format with appedicies on the end column with which row it belonged to from the original "fulldata".