function [ output_args ] = ImageEigenvectorsLight( myvec)
%demonstration of "machine learning" following some ideas from 
% "Data Driven Modeling & Scientific Computation", by J.N. Kutz
%% Provide myvec: a vector of length 2 that you compare to the training images
    a=25;
    clf;
    %% dimension 1: "Toy Story"
    %% dimension 2: "Revenant"
    %%%%% create your "data"
%% Loves All movies, prefers grown-up
    c = [1,2];
    for k=1:10
        cr(k,:)=c+0.5*rand(size(c)),
    end
   scatter(cr(:,1),cr(:,2),a,'b');
   hold on;
   axis([-5,5,-5,5]);
   
    %% Hates anime, loves violence
    o = [-3,3];
    for k=1:10
        or(k,:)=o+0.7*rand(size(o)),
    end
    scatter(or(:,1),or(:,2)),a,'y';
   
    %% Loves anime, nothing else
    t = [3,0];
    for k=1:10
        tr(k,:)=t+0.2*rand(size(t)),
    end
    scatter(tr(:,1),tr(:,2)),a,'r';
    
    %% hates violent movies
    d = [0,-2];
    for k=1:10
        dr(k,:)=d+1.2*rand(size(d)),
    end
    scatter(dr(:,1),dr(:,2)),a,'g';
  
    
    %%%% now find the Eigenvectors of the data set
    crave = sum(cr(1:end,:))/10;
    orave = sum(or(1:end,:))/10;
    trave = sum(tr(1:end,:))/10;
    drave = sum(dr(1:end,:))/10;
    scatter(crave(:,1),crave(:,2),a,'b','filled');
    scatter(orave(:,1),orave(:,2),a,'y','filled');
    scatter(trave(:,1),trave(:,2),a,'r','filled');
    scatter(drave(:,1),drave(:,2),a,'g','filled');
       
    hold off;
    pause;
    %% now use this data as training images
    
    DATA = [cr;or;tr;dr]; 
    C =  DATA'*DATA;   %% or use C = cov(DATA); %% or use SVD on DATA 
    [V,D] = eigs(C,2,'lm');
   
    %plot(diag(D));pause
   
    figure(1);proj = c*V; bar(proj);title('C signature');ylim([-5,5]);
    pause;
    figure(2);proj = o*V; bar(proj);title('O signature');ylim([-5,5]);
    pause;
    figure(3);proj = t*V; bar(proj);title('T signature');ylim([-5,5]);
    pause;
    figure(4);proj = d*V; bar(proj);title('D signature');ylim([-5,5]);
    pause;
    
    figure(5); proj = myvec*V; bar(proj);title('Your signature');pause;
    %%%% 
    
    %% Project: devise your own application with at least four dimensions
    %% Create/provide hypothetical data with at least two clusters
    %% Provide an example how a new "person" is recognized as being in one of the clusters
    
end

