Commit 8874b7ab authored by Carlos Mejia's avatar Carlos Mejia
Browse files

Minor changes adding some display if tracking>0 and >1

parent 5db0b6f6
......@@ -536,7 +536,12 @@ radius(find(radius==0)) = eps;
H=diag(ones(1,blen));
%% Apprentissage
if tracking>1,
fprintf(1,' ... tlen=%s with %d radius values varying between %s and %s\n', ...
num2str(trainlen),length(radius),num2str(radius(1)),num2str(radius(end)));
end
for t = 1:trainlen,
if tracking>1, fprintf(1,' ... rad=%s ',num2str(radius(t))); end
% t=1 initialisation
if t==1,
%% Affectation des observations aux cellules
......@@ -766,7 +771,7 @@ function [] = trackplot(M,D,tracking,start,n,qe)
l = length(qe);
elap_t = etime(clock,start);
tot_t = elap_t*l/n;
fprintf(1,'\rTraining: %3.0f/ %3.0f s',elap_t,tot_t)
fprintf(1,'\r Training: %3.0f/ %3.0f s',elap_t,tot_t)
switch tracking
case 1,
case 2,
......
......@@ -250,17 +250,19 @@ function [sMap sMap_denorm Result] = learn_2s_som(A,nb_neurone,varargin)
% end
if bool_pre_training
tracking_ini = tracking;
%tracking_ini = 1;
pretrain_tracking = tracking;
%pretrain_tracking = 1;
% batchtrain avec radius ...
if (bool_rad && ~bool_trainlen)
fprintf(1,'\n-- BATCHTRAIN initial avec radius ... ')
if tracking_ini, fprintf(1,'\n'); end
if pretrain_tracking, fprintf(1,'\n'); end
j=1;
while j<length(rad)
sMap=som_batchtrain(sMap,sD_norm.data,'radius',[rad(j) rad(j+1)],'tracking',tracking_ini);
sMap=som_batchtrain(sMap, sD_norm.data, ...
'radius',[rad(j) rad(j+1)], ...
'tracking',pretrain_tracking);
j=j+1;
end
......@@ -268,11 +270,13 @@ function [sMap sMap_denorm Result] = learn_2s_som(A,nb_neurone,varargin)
% batchtrain avec trainlen ...
if (~bool_rad && bool_trainlen)
fprintf(1,'\n-- BATCHTRAIN initial avec trainlen ... ')
if tracking_ini, fprintf(1,'\n'); end
if pretrain_tracking, fprintf(1,'\n'); end
j=1;
while j<=length(trlen)
sMap=som_batchtrain(sMap,sD_norm.data,'trainlen',trlen(j),'tracking',tracking_ini);
sMap=som_batchtrain(sMap, sD_norm.data, ...
'trainlen',trlen(j), ...
'tracking',pretrain_tracking);
j=j+1;
end
......@@ -280,13 +284,16 @@ function [sMap sMap_denorm Result] = learn_2s_som(A,nb_neurone,varargin)
% batchtrain avec radius et trainlen
if (bool_rad && bool_trainlen)
fprintf(1,'\n-- BATCHTRAIN initial avec radius et trainlen ... \n')
if tracking_ini, fprintf(1,'\n'); end
if pretrain_tracking, fprintf(1,'\n'); end
if length(rad)==length(trlen)+1
j=1;
while j<length(rad)
sMap=som_batchtrain(sMap,sD_norm.data,'radius',[rad(j) rad(j+1)],'trainlen',trlen(j),'tracking',tracking_ini);
sMap=som_batchtrain(sMap, sD_norm.data, ...
'radius',[rad(j) rad(j+1)], ...
'trainlen',trlen(j), ...
'tracking',pretrain_tracking);
j=j+1;
end
......@@ -358,9 +365,18 @@ function [sMap sMap_denorm Result] = learn_2s_som(A,nb_neurone,varargin)
i_train = 1;
n_train = length(lambda)*length(eta);
radius_2s_som = [rad(round(length(rad)/2)) ...
rad((round(length(rad)/2))+1)];
trainlen_2s_som = trlen(round(length(trlen)/2));
fprintf(1,[ '\n-- batchtrainRTOM loop for %d lambda and %d eta values:\n', ...
'-- ------------------------------------------------------------------\n' ], ...
length(lambda), length(eta));
if tracking > 1,
fprintf(1,' ... trainlen_2s_som ... %s\n', num2str(trainlen_2s_som))
fprintf(1,' ... radius_2s_som ..... [%s]\n', join(string(radius_2s_som),', '))
end
for i=1:length(lambda)
for j=1:length(eta)
fprintf(1,'-- batchtrainRTOM (%d/%d) with lambda=%s and eta=%s ... ',i_train, ...
......@@ -374,9 +390,8 @@ function [sMap sMap_denorm Result] = learn_2s_som(A,nb_neurone,varargin)
'DimBloc',DimBloc, ...
'lambda', lambda(i), ...
'eta',eta(j), ...
'radius',[rad(round(length(rad)/2)) ...
rad((round(length(rad)/2))+1)], ...
'trainlen',trlen(round(length(trlen)/2)), ...
'radius',radius_2s_som, ...
'trainlen',trainlen_2s_som, ...
'tracking',tracking);
current_perf = som_distortion(Result(i,j).sMap,sD_norm);
......
......@@ -455,8 +455,8 @@ for t = 1:trainlen,
case 'cutgauss', H = exp(-Ud/(2*radius(t))) .* (Ud<=radius(t));
case 'ep', H = (1-Ud/radius(t)) .* (Ud<=radius(t));
end
if tracking > 0,
disp(sprintf('radius(%d)=%s',t,num2str(radiuss(1))))
if tracking > 1,
disp(sprintf(' radius(%d)=%s',t,num2str(radius(t))))
end
% update
......
......@@ -302,6 +302,7 @@ else
case 'long', sTrain.trainlen = sTrain.trainlen*4;
end
end
if tracking>1, fprintf(1,' ... trainlen=%d iterations.\n',sTrain.trainlen); end
sTrain.neigh=neigh; %OM
switch func,
case 'seq', sMap = som_seqtrain(sMap,D,sTrain,'tracking',tracking,'mask',mask);
......@@ -320,6 +321,7 @@ else
case 'long', sTrain.trainlen = sTrain.trainlen*4;
end
end
if tracking>1, fprintf(1,' ... trainlen=%d iterations.\n',sTrain.trainlen); end
sTrain.neigh=neigh; %OM
switch func,
case 'seq', sMap = som_seqtrain(sMap,D,sTrain,'tracking',tracking,'mask',mask);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment