
X = randi(20,10,12)
X = (X - mean(X))*10
CV = X'*X 
[V,D] = eig(CV)
S_vip = X*V  


A = load('../../../../CS6220DM/data/mldata/mnist-original.mat') 
X = A.data' ; 
size(X)  
X = double(X); 
y = kmeans(X',kseeds(X',10));
y
L = A.label;
L
ind2 = find(L==2);  
size(ind2)  
histogram(y(ind2))  
whos
pause;
 
 
 P = pca(X);  
 size(P) 
  X3 = X*P(:,1:3);  
 size(X3)
 
 y3 = kmeans(X3',kseeds(X3',10));  
 histogram(y3(ind2))
 
 X20 = X*P(:,1:20);     
 y20 = kmeans(X20',kseeds(X20',10)); 
 
 histogram(y20(ind7))  
  plot3 (X3(ind5,1), X3(ind5,2), X3(ind5,3), 'g.')
  grid on 
  hold on
  plot3 (X3(ind2,1), X3(ind2,2), X3(ind2,3), 'r.')   
  plot3 (X3(ind7,1), X3(ind7,2), X3(ind7,3), 'b.')  
 
