function example(data,algorithm,selection)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%function example(data,algorithm)
%
% This is the main function used to run the experiments that are detailed in http://isa.umh.es/arvc/personal/suni/ica_pca/index.html
%
% algorithm ====> %algorithm selected: (Fastica ==> 1; Infomax ==> 2)
% data ====> %data selected: (1,2,3,4)
% selection ====> %feature selection: (NO ==> 0; YES ==> 1)
path(path,'./FastICA_25');
see=1; % see ---> seeing or not the plots: (NO ==> 0; YES ==> 1)
switch data
case 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ARTIFICIAL DATASET (figure 5a from paper) ICA better than PCA
x=data_artificialset(1,see); %% generate the data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nc=2; %number of classes
np=300; %number of samples per class
n_vectors=2; %number of vectors used to reduce the data
nr=2; %number of repetitions of the classification process
per_test=0.5; %percentage of test samples from x (0-1)
data_file=extraction(x,nc,np,algorithm,n_vectors,see); %feature extraction (PCA and ICA)
[p_ica, p_white]=classifier(data_file,nc,np,algorithm,per_test,n_vectors,nr,selection,see); %classification with k-NN
case 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ARTIFICIAL DATASET (figure 5b from paper) PCA better than ICA
x=data_artificialset(2,see); %% generate the data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nc=2; %number of classes
np=300; %number of samples per class
n_vectors=2; %number of vectors used to reduce the data
nr=5; %number of repetitions of the classification process
per_test=0.5; %percentage of test samples from x (0-1)
data_file=extraction(x,nc,np,algorithm,n_vectors,see); %feature extraction (PCA and ICA)
[p_ica, p_white]=classifier(data_file,nc,np,algorithm,per_test,n_vectors,nr,selection,see); %classification with k-NN
case 3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Images from COIL-100 %%http://www1.cs.columbia.edu/CAVE/software/softlib/coil-100.php
objects=50;
np=20; %number of samples per class
x=data_coil_100(objects,np,see);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nc=objects; %number of classes
n_vectors=10; %number of vectors used to reduce the data
nr=5; %number of repetitions of the classification process
per_test=0.5; %percentage of test samples from x (0-1)
data_file=extraction(x,nc,np,algorithm,n_vectors,see);%feature extraction (PCA and ICA)
[p_ica, p_white]=classifier(data_file,nc,np,algorithm,per_test,n_vectors,nr,selection,see);%classification with k-NN
case 4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Images from ORL FACE DATABASE %%%%http://people.cs.uchicago.edu/~dinoj/vis/ORL.zip
objects=40;
np=10; %number of samples per class
x=data_orl_faces(objects,np,see);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nc=objects; %number of classes
n_vectors=5; %number of vectors used to reduce the data
nr=5; %number of repetitions of the classification process
per_test=0.5; %percentage of test samples from x (0-1)
data_file=extraction(x,nc,np,algorithm,n_vectors,see);%feature extraction (PCA and ICA)
[p_ica, p_white]=classifier(data_file,nc,np,algorithm,per_test,n_vectors,nr,selection,see);%classification with k-NN
otherwise
error('Select a number between "1 and 4"!!')
end