%% Test FAMS on 5D data

%% randomize data

vect1 = rand(1000,5)*100; % uniform 

sigma2=[1,3,1,3,2]*5;
mu2=[70,60,70,55,89];
vect2 = randn(120,5);
vect2 = vect2.*repmat(sigma2,size(vect2,1),1)+repmat(mu2,size(vect2,1),1);

sigma3=[1,3,1,3,2]*5;
mu3=[20,10,15,55,9];
vect3 = randn(100,5);
vect3 = vect3.*repmat(sigma3,size(vect3,1),1)+repmat(mu3,size(vect3,1),1);

data=[vect1;  vect2; vect3];

%% run FAMS
[modes, p_modes, w_modes]=fams(data,20,15,200,'5Ddata','res/','-h',20);

%% view results
format short g;
p_modes

% this script results:
% p_modes =
%          1533       70.356        60.01       69.579       56.076       89.433
%          1162       19.909       9.4154       15.675       54.572       8.4813
%            48       36.851       29.007       82.868       43.807       28.804
%            47       37.235       26.553       49.035       28.731       71.776


% % here the results of meanshift_Euclidian function
% % the first two vectors in <res> matrix - view like <mu2> and <mu3> vectors
% % [res, num_rows,mean_vals,data_group, sample_num ] =meanshift_Euclidian(data,0.1);
% %>> res(1:4,:)
% % ans =
% %    70.0758   59.9020   70.0746   54.5983   88.6178
% %    19.8981   10.0129   14.9481   55.1258    9.3043
% %    87.8244   37.2915   64.2528   58.1243   37.1069
% %    41.5967   27.2727   49.5976   19.0590   12.5807
% % >> size(res)
% % ans =
% %    535     5
% % >> num_rows(1:15,:)
% % ans =
% %    126
% %    107
% %     14
% %     11
% % 
% % ===========================================
% % >> ans =
% %    546     5
% % ans =
% %    69.9826   59.7245   70.1298   54.9041   89.0960
% %    20.0367    9.7626   15.0001   55.1254    9.0817
% %    72.1779   16.1155   43.0180   51.8788   81.5878
% %    18.3489   57.1178   72.5199   35.9218   50.6380
% % ans =
% %    127
% %    100
% %     14
% %     14