Commit 010a99af authored by Carlos Mejia's avatar Carlos Mejia
Browse files

Conversion dos2unix de tout *.m

parent 273f9aad
function [clust, clcell, clcellConsol, DB_index]=CAHOM(sMap,bmus,Nbclust,TypeCAH,CAHIndex)
% sMap : ta carte
% msize: les dimensions de ta cartes exemple : [10 10]
% name : un nom banale pour identifier nommer ta carte exemple : 'OM'
% bmus le bmus initial associ? ? sMap exemple : bah c'est le bmus quoi !!!
% Nbclust le nombre de classe souhaite exemple : 7
% CAH contrainte et consolid?e
% TypeCAH='My'; consolide
CahCluster1 = som_cllinkage(sMap,CAHIndex,'connect','neighbors');
%[Dendro1]=som_dendrogram(CahCluster1.tree,sMap,'colorthreshold','default');
%set(Dendro1,'LineWidth',2);
DB_index=[];
nb_clust=2;
while nb_clust<20,
clust=cluster(CahCluster1.tree,'maxclust',nb_clust);
DB_index(nb_clust)=db_index(sMap,clust);
nb_clust=nb_clust+1;
end
DB_index(1)=DB_index(2);
[A,B]=min(DB_index);
plot([1:19],DB_index,'--bs','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColor','r','MarkerSize',3);
%xlabel('Clustering');
%ylabel('Indice de Davie-Bouldin');
clust=cluster(CahCluster1.tree,'maxclust',Nbclust);
clcell=clust;
%%%%%%%%%%%%%% consolidation des cartes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
uniq=unique(clust);
MyCentroids=zeros(length(uniq),size(sMap.codebook,2));
for i=1:length(unique(clust))
MyCentroids(i,:)=mean(sMap.codebook(find(clust==uniq(i)),:));
end
[Clust ClConsol]=som_kmeans('batch',sMap,Nbclust,TypeCAH,MyCentroids);
ClConsol=ClConsol';
clcellConsol=ClConsol;
Carte=[clust,ClConsol];
%pour la structure carte%%%%%%% rajout des label%%%
for k=1:Nbclust
pos1=find(clust==k);
pos2=find(ClConsol==k);
for i=1:size(pos1,1)
clust_obs(bmus==pos1(i))=k; %#ok<AGROW>
end
for j=1:size(pos2,1)
clust_obsConsol(bmus==pos2(j))=k; %#ok<AGROW>
end
end
clust=[clust_obs; clust_obsConsol];
clust=clust';
function [clust, clcell, clcellConsol, DB_index]=CAHOM(sMap,bmus,Nbclust,TypeCAH,CAHIndex)
% sMap : ta carte
% msize: les dimensions de ta cartes exemple : [10 10]
% name : un nom banale pour identifier nommer ta carte exemple : 'OM'
% bmus le bmus initial associ? ? sMap exemple : bah c'est le bmus quoi !!!
% Nbclust le nombre de classe souhaite exemple : 7
% CAH contrainte et consolid?e
% TypeCAH='My'; consolide
CahCluster1 = som_cllinkage(sMap,CAHIndex,'connect','neighbors');
%[Dendro1]=som_dendrogram(CahCluster1.tree,sMap,'colorthreshold','default');
%set(Dendro1,'LineWidth',2);
DB_index=[];
nb_clust=2;
while nb_clust<20,
clust=cluster(CahCluster1.tree,'maxclust',nb_clust);
DB_index(nb_clust)=db_index(sMap,clust);
nb_clust=nb_clust+1;
end
DB_index(1)=DB_index(2);
[A,B]=min(DB_index);
plot([1:19],DB_index,'--bs','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColor','r','MarkerSize',3);
%xlabel('Clustering');
%ylabel('Indice de Davie-Bouldin');
clust=cluster(CahCluster1.tree,'maxclust',Nbclust);
clcell=clust;
%%%%%%%%%%%%%% consolidation des cartes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
uniq=unique(clust);
MyCentroids=zeros(length(uniq),size(sMap.codebook,2));
for i=1:length(unique(clust))
MyCentroids(i,:)=mean(sMap.codebook(find(clust==uniq(i)),:));
end
[Clust ClConsol]=som_kmeans('batch',sMap,Nbclust,TypeCAH,MyCentroids);
ClConsol=ClConsol';
clcellConsol=ClConsol;
Carte=[clust,ClConsol];
%pour la structure carte%%%%%%% rajout des label%%%
for k=1:Nbclust
pos1=find(clust==k);
pos2=find(ClConsol==k);
for i=1:size(pos1,1)
clust_obs(bmus==pos1(i))=k; %#ok<AGROW>
end
for j=1:size(pos2,1)
clust_obsConsol(bmus==pos2(j))=k; %#ok<AGROW>
end
end
clust=[clust_obs; clust_obsConsol];
clust=clust';
% comparaison multiple
AnovaTest1=reshape(Res,100,1);
AnovaTest2=reshape(Res',100,1);
subplot(211)
[p,t,st1] = anova1(AnovaTest1,label,'off');
[c,m,h,nms] = multcompare(st1,'estimate','kruskalwallis','display','on');
subplot(212)
[p,t,st2] = anova1(AnovaTest2,label,'off');
[c,m,h,nms] = multcompare(st2,'estimate','kruskalwallis','display','on');
% comparaison multiple
AnovaTest1=reshape(Res,100,1);
AnovaTest2=reshape(Res',100,1);
subplot(211)
[p,t,st1] = anova1(AnovaTest1,label,'off');
[c,m,h,nms] = multcompare(st1,'estimate','kruskalwallis','display','on');
subplot(212)
[p,t,st2] = anova1(AnovaTest2,label,'off');
[c,m,h,nms] = multcompare(st2,'estimate','kruskalwallis','display','on');
function [ vec ] = Disjonctif(Bmus,Nb_Cell)
%UNTITLED10 Summary of this function goes here
% Detailed explanation goes here
%Var est un vecteur contenant la position de la modalité maximale pour
%chaque referent
DimX=length(Bmus);
Disj=zeros(Nb_Cell,DimX);
%modality=unique(Bmus);
for i=1:Nb_Cell
vec=zeros(1,DimX);
for j=1:DimX
vec(Bmus==i)=1;
end
Disj(i,:)=vec;
end
end
function [ vec ] = Disjonctif(Bmus,Nb_Cell)
%UNTITLED10 Summary of this function goes here
% Detailed explanation goes here
%Var est un vecteur contenant la position de la modalité maximale pour
%chaque referent
DimX=length(Bmus);
Disj=zeros(Nb_Cell,DimX);
%modality=unique(Bmus);
for i=1:Nb_Cell
vec=zeros(1,DimX);
for j=1:DimX
vec(Bmus==i)=1;
end
Disj(i,:)=vec;
end
end
function [distorsion Result] = Distorsion( Result, D,Nbclust)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
Dim=size(Result);distorsion=zeros(Dim(1),Dim(2));
for i=1:Dim(1)
for j=1:Dim(2)
Dist=0.0;
for k=1:size(Result(i,j).res,2)
Dist=Dist+som_distortion(Result(i,j).res(k).sMap,D)/size(D,2);
[Result(i,j).res(k).cl Result(i,j).CellCl(:,k) Result(i,j).CellConSol(:,k)]=CAHOM(Result(i,j).res(k).sMap,Result(i,j).res(k).bmus,Nbclust,'My','ward');
end
distorsion(i,j)=Dist/10;
end
end
end
function [distorsion Result] = Distorsion( Result, D,Nbclust)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
Dim=size(Result);distorsion=zeros(Dim(1),Dim(2));
for i=1:Dim(1)
for j=1:Dim(2)
Dist=0.0;
for k=1:size(Result(i,j).res,2)
Dist=Dist+som_distortion(Result(i,j).res(k).sMap,D)/size(D,2);
[Result(i,j).res(k).cl Result(i,j).CellCl(:,k) Result(i,j).CellConSol(:,k)]=CAHOM(Result(i,j).res(k).sMap,Result(i,j).res(k).bmus,Nbclust,'My','ward');
end
distorsion(i,j)=Dist/10;
end
end
end
function EVAL = Evaluate(ACTUAL,PREDICTED)
% This fucntion evaluates the performance of a classification model by
% calculating the common performance measures: Accuracy, Sensitivity,
% Specificity, Precision, Recall, F-Measure, G-mean.
% Input: ACTUAL = Column matrix with actual class labels of the training
% examples
% PREDICTED = Column matrix with predicted class labels by the
% classification model
% Output: EVAL = Row matrix with all the performance measures
idx = (ACTUAL()==1);
p = length(ACTUAL(idx));
n = length(ACTUAL(~idx));
N = p+n;
tp = sum(ACTUAL(idx)==PREDICTED(idx));
tn = sum(ACTUAL(~idx)==PREDICTED(~idx));
fp = n-tn;
fn = p-tp;
tp_rate = tp/p;
tn_rate = tn/n;
accuracy = (tp+tn)/N;
sensitivity = tp_rate;
specificity = tn_rate;
precision = tp/(tp+fp);
recall = sensitivity;
f_measure = 2*((precision*recall)/(precision + recall));
gmean = sqrt(tp_rate*tn_rate);
function EVAL = Evaluate(ACTUAL,PREDICTED)
% This fucntion evaluates the performance of a classification model by
% calculating the common performance measures: Accuracy, Sensitivity,
% Specificity, Precision, Recall, F-Measure, G-mean.
% Input: ACTUAL = Column matrix with actual class labels of the training
% examples
% PREDICTED = Column matrix with predicted class labels by the
% classification model
% Output: EVAL = Row matrix with all the performance measures
idx = (ACTUAL()==1);
p = length(ACTUAL(idx));
n = length(ACTUAL(~idx));
N = p+n;
tp = sum(ACTUAL(idx)==PREDICTED(idx));
tn = sum(ACTUAL(~idx)==PREDICTED(~idx));
fp = n-tn;
fn = p-tp;
tp_rate = tp/p;
tn_rate = tn/n;
accuracy = (tp+tn)/N;
sensitivity = tp_rate;
specificity = tn_rate;
precision = tp/(tp+fp);
recall = sensitivity;
f_measure = 2*((precision*recall)/(precision + recall));
gmean = sqrt(tp_rate*tn_rate);
EVAL = [accuracy sensitivity specificity precision recall f_measure gmean];
\ No newline at end of file
% Fusion de SOM
%Base =D
%% DMU
%DimData=[76 216 64 240 47 6]
%Data(1).D=D(:,1:76);
%Data(2).D=D(:,77:292);
%Data(3).D=D(:,293:356);
%Data(4).D=D(:,357:596);
%Data(5).D=D(:,597:643);
%Data(6).D=D(:,644:649);
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% IS
% Data(1).D=D(:,1:9);
% Data(2).D=D(:,10:19);
%% CT3
% Data(1).D=D(:,1:7);
% Data(2).D=D(:,8:11);
% Data(3).D=D(:,12:21);
%% FGKM data
% Data(1).D=D(:,1:10);
% Data(2).D=D(:,11:20);
% Data(3).D=D(:,21:50);
RFusion=struct;RSOM=struct;
%% pr-traitement des donnes
figure
for ii=1:Appr,
subplot(2,5,ii)
[PresMap PreBmus] = som_make(D,'init', 'randinit','training','long' );
[Precl(i).res PreclcellOR(:,i) PreConsolOR(:,i) PreDB(:,i)]=CAHOM(PresMap,PreBmus,Nbclust,TypeCAH,CAHIndex{6});
for i=1:10,
[c,p,err,ind(:,i)]=kmeans_clusters(PresMap,10);
end
Ind=mean(ind([2:10]',:));
plot(1:length(Ind),Ind,'x-');
end
Nbclust=What;
for k=1:Appr
%% Etude gnrale
[RSOM(k).sMapOR RSOM(k).BmusOM] = som_make(D, 'init', 'randinit','training','long' );
[RSOM(k).clustOR RSOM(k).clcellOR RSOM(k).clcellConsolOR]=CAHOM(RSOM(k).sMapOR,RSOM(k).BmusOM,Nbclust,TypeCAH,CAHIndex{6});
RSOM(k).Cluster=RSOM(k).clustOR(:,2);
for b=1:B
%figure
[RFusion(k).Result(b).sMap RFusion(k).Result(b).bmus] = som_make(Data(b).D,'init', 'randinit', 'training','long' );
RFusion(k).Result(b).distorsion = (som_distortion(RFusion(k).Result(b).sMap,Data(b).D))/size(Data(b).D,2);
RFusion(k).Result(b).Z_tilde=RFusion(k).Result(b).sMap.codebook(RFusion(k).Result(b).bmus,:);
[RFusion(k).Result(b).clust RFusion(k).Result(b).clcell RFusion(k).Result(b).clcellConsol]=CAHOM(RFusion(k).Result(b).sMap,RFusion(k).Result(b).bmus,Nbclust,TypeCAH,CAHIndex{6});
RSOM(k).Cluster=[RSOM(k).Cluster RFusion(k).Result(b).clust(:,2)];
end
% Calcul des mu_b
for b=1:B
RFusion(k).Distor(b) = 1/RFusion(k).Result(b).distorsion;
end
RFusion(k).Z_tilde=[];
RFusion(k).Z_Directe=[];
for b=1:B
RFusion(k).Result(b).mu=RFusion(k).Distor(b)/sum(RFusion(k).Distor);
RFusion(k).Z_tilde=[RFusion(k).Z_tilde RFusion(k).Result(b).mu*RFusion(k).Result(b).Z_tilde];
RFusion(k).Z_Directe=[RFusion(k).Z_Directe RFusion(k).Result(b).Z_tilde];
end
%% creation de la table Z_tilde
[RFusion(k).Fusion RFusion(k).FusionBmus] = som_make(RFusion(k).Z_tilde, 'init', 'randinit','training','long' );
[RFusion(k).Directe RFusion(k).DirecteBmus] = som_make(RFusion(k).Z_Directe, 'init', 'randinit','training','long');
% %% Comparaison des partitions
[RFusion(k).Fusionclust RFusion(k).Fusionclcell RFusion(k).FusionclcellConsol]=CAHOM(RFusion(k).Fusion,RFusion(k).FusionBmus,Nbclust,TypeCAH,CAHIndex{6});
[RFusion(k).Directeclust RFusion(k).Directeclcell RFusion(k).DirecteclcellConsol]=CAHOM(RFusion(k).Directe,RFusion(k).DirecteBmus,Nbclust,TypeCAH,CAHIndex{6});
%% creation de la matrice des partitions
RSOM(k).Cluster=[RSOM(k).Cluster RFusion(k).Fusionclust(:,2)];
RSOM(k).Cluster=[RSOM(k).Cluster RFusion(k).Directeclust(:,2)];
%% Kmeans paritions
[RFusion(k).KMclust]=kmeans(D,Nbclust);
RSOM(k).Cluster=[RSOM(k).Cluster RFusion(k).KMclust];
RSOM(k).Cluster=[RSOM(k).Cluster Label];
%for k=1:Appr
for i=1:size(RSOM(k).Cluster,2)
for j=1:size(RSOM(k).Cluster,2)
Res=comparaison_partitionOM(RSOM(k).Cluster(:,i),RSOM(k).Cluster(:,j));
RFusion(k).rand(i,j)=Res.indice.rand;
RFusion(k).jaccard(i,j)=Res.indice.jaccard;
RFusion(k). tanimoto(i,j)=Res.indice.tanimoto;
RFusion(k).VI(i,j)=Res.indice.VI;
RFusion(k).nmi(i,j)=Res.indice.nmi;
RFusion(k).nvi(i,j)=Res.indice.nvi;
RFusion(k).Precision(i,j)=Res.Performance.Precision;
RFusion(k).Recall(i,j)=Res.Performance.Recall;
RFusion(k).Fmeasure(i,j)=Res.Performance.Fmeasure;
RFusion(k).Accuracy(i,j)=Res.Performance.Accuracy;
end
end
end
%%%%%%%% La moyenne et l'cart type des indices
B0B=size(RSOM(k).Cluster,2);
Perf=struct;
Perf.Rand=zeros(B0B,B0B); Perf.Jaccard=zeros(B0B,B0B);
Perf.Tanimoto=zeros(B0B,B0B); Perf.VI=zeros(B0B,B0B);
Perf.Precision=zeros(B0B,B0B); Perf.Recall=zeros(B0B,B0B);
Perf.Fmeasure=zeros(B0B,B0B); Perf.Accuracy=zeros(B0B,B0B);
Perf.nmi=zeros(B0B,B0B); Perf.nvi=zeros(B0B,B0B);
VarRand=zeros((B0B)*(B0B),1); VarJaccard=zeros((B0B)*(B0B),1);
VarTanimoto=zeros((B0B)*(B0B),1); VarVI=zeros((B0B)*(B0B),1);
VarPrecision=zeros((B0B)*(B0B),1); VarRecall=zeros((B0B)*(B0B),1);
VarFmeasure=zeros((B0B)*(B0B),1); VarAccuracy=zeros((B0B)*(B0B),1);
Varnmi=zeros((B0B)*(B0B),1); Varnvi=zeros((B0B)*(B0B),1);
for k=1:Appr
Perf.Rand=Perf.Rand+RFusion(k).rand/Appr;
Perf.Jaccard=Perf.Jaccard+RFusion(k).jaccard/Appr;
Perf.Tanimoto=Perf.Tanimoto+RFusion(k). tanimoto/Appr;
Perf.VI=Perf.VI+RFusion(k).VI/(B0B);
Perf.Precision=Perf.Precision+RFusion(k).Precision/Appr;
Perf.Recall=Perf.Recall+RFusion(k).Recall/Appr;
Perf.Fmeasure=Perf.Fmeasure+RFusion(k).Fmeasure/Appr;
Perf.Accuracy=Perf.Accuracy+RFusion(k).Accuracy/Appr;
Perf.nmi=Perf.nmi+RFusion(k).nmi/Appr;
Perf.nvi=Perf.nvi+RFusion(k).nvi/Appr;
%% Les matrices des variances
VarRand=[VarRand reshape(RFusion(k).rand,(B0B)*(B0B),1)];
VarJaccard=[VarJaccard reshape(RFusion(k).jaccard,(B0B)*(B0B),1)];
VarTanimoto=[VarTanimoto reshape(RFusion(k).tanimoto,(B0B)*(B0B),1)];
VarVI=[VarVI reshape(RFusion(k).VI,(B0B)*(B0B),1)];
VarPrecision=[VarPrecision reshape(RFusion(k).Precision,(B0B)*(B0B),1)];
VarRecall=[VarRecall reshape(RFusion(k).Recall,(B0B)*(B0B),1)];
VarFmeasure=[VarFmeasure reshape(RFusion(k).Fmeasure,(B0B)*(B0B),1)];
VarAccuracy=[VarAccuracy reshape(RFusion(k).Accuracy,(B0B)*(B0B),1)];
Varnmi=[Varnmi reshape(RFusion(k).nmi,(B0B)*(B0B),1)];
Varnvi=[Varnvi reshape(RFusion(k).nvi,(B0B)*(B0B),1)];
end
%%%%%%%%%%%% cart-types
StdRand=reshape(std(VarRand'),B0B,B0B);
StdJaccard=reshape(std(VarJaccard'),B0B,B0B);
StdTanimoto=reshape(std(VarTanimoto'),B0B,B0B);
StdVI=reshape(std(VarVI'),B0B,B0B);
Stdnmi=reshape(std(Varnmi'),B0B,B0B);
Stdnvi=reshape(std(Varnvi'),B0B,B0B);
StdPrecision=reshape(std(VarPrecision'),B0B,B0B);
StdRecall=reshape(std(VarRecall'),B0B,B0B);
StdFmeasure=reshape(std(VarFmeasure'),B0B,B0B);
StdAccuracy=reshape(std(VarAccuracy'),B0B,B0B);
%% NMF et WNMF
% Creation et de l'ensemble des partitions pour les bases
for k=1:Appr
clear EnsPartition;
for b=1:B
EnsPartition(b,:)=RSOM(k).Cluster(:,b+1);
end
nb_partition=size(EnsPartition,1);
%tableau de structure pour les matrice de connectivit des partitions
all_conMatrix = allConMatrix( EnsPartition );
%W est le vecteur des poids l'initialisation: ts les partitions ont le mme
%poids
W=zeros(nb_partition,1);
for i=1: nb_partition
W(i)=1/nb_partition;
end
M_avg= agreConnMat( all_conMatrix,W);
%% Apprentissage NMF et WNMF
[bmusNMF(:,k)]=NMFCluster( M_avg,Nbclust);
[bmusWNMF(:,k)]=NMFClusterWNMF( M_avg,Nbclust);
RNMF1(k)=comparaison_partitionOM(Label,bmusNMF(:,k));
RWNMF1(k)=comparaison_partitionOM(Label,bmusWNMF(:,k));
%% Apprentissage CSPA
% 'single' --- nearest distance
% 'complete' --- furthest distance
% 'average' --- unweighted average distance (UPGMA) (also known as
% group average)
% 'weighted' --- weighted average distance (WPGMA)
% 'centroid' --- unweighted center of mass distance (UPGMC) (*)
% 'median' --- weighted center of mass distance (WPGMC) (*)
% 'ward' --- inner squared distance (min variance algorithm) (*)
Y = pdist(M_avg,'euclid');
for idx=6:6,
Z = linkage(Y,CAHIndex{idx});
T(k).CAHIndex(idx).res = cluster(Z,'maxclust',Nbclust);
RCSPA.CAH(idx).res(k)=comparaison_partitionOM(Label, T(k).CAHIndex(idx).res);
end
end
[ StatIndex( RCSPA.CAH(idx).res), StatIndex( RWNMF1) StatIndex(RNMF1)]
%% reprsentation graphique des cartes
%som_plotplane(RFusion(k).Result(b).sMap, M, 'b');
% STEP 4: VISUALIZING THE SELF-ORGANIZING MAP: SOM_SHOW_ADD
% =========================================================
% The SOM_SHOW_ADD function can be used to add markers, labels and
% trajectories on top of SOM_SHOW created figures. The function
% SOM_SHOW_CLEAR can be used to clear them away.
% Here, the U-matrix is shown on the left, and an empty grid
% named 'Labels' is shown on the right.
% Pour la table originiale
figure
for i=1:Appr,
subplot(2,5,i)
[c,p,err,ind(:,i)]=kmeans_clusters(RFusion(i).Fusion,10);
plot(1:length(ind(:,i)),ind(:,i),'x-');
end
figure
Ind=mean(ind([2:10]',:));
plot(1:length(Ind),Ind,'x-');
RFusion(k).Result(b).distorsion
for b=1:B
figure
sD=Data(b).D;
sM1=RFusion(k).Result(b).sMap;
sM2=RFusion(k).Result(b).sMap;
comp=size(sM2.codebook,2);
sM1.codebook(:,end)=RFusion(k).Result(b).clcellConsol;
sD = som_data_struct(sD);
sD=som_label(sD,'add',[1:length(Label)]',num2str(Label));
sM2 = som_autolabel(sM2,sD,'vote');
sM1 = som_autolabel(sM1,sD,'vote');
som_show(sM1,'comp',comp);
%som_show_add('label',sM2.labels,'textsize',5,'textcolor','k');
end
%fusion
figure
sD=RFusion(pos).Z_tilde;
sM1=RFusion(pos).Fusion;
sM2=RFusion(pos).Fusion;
comp=size(sM2.codebook,2);
sM1.codebook(:,end)=RFusion(pos).FusionclcellConsol;
sD = som_data_struct(sD);
sD=som_label(sD,'add',[1:length(Label)]',num2str(Label));
sM2 = som_autolabel(sM2,sD,'vote');
sM1 = som_autolabel(sM1,sD,'vote');
som_show(sM1,'comp',comp);
%som_show_add('label',sM2.labels,'textsize',8,'textcolor','k');
figure
%fusion
sD=RFusion(pos).Z_Directe;
sM1=RFusion(pos).Directe;
sM2=RFusion(pos).Directe;
comp=size(sM2.codebook,2);
sM1.codebook(:,end)=RFusion(pos).DirecteclcellConsol;
sD = som_data_struct(sD);
sD=som_label(sD,'add',[1:length(Label)]',num2str(Label));
sM2 = som_autolabel(sM2,sD,'vote');
sM1 = som_autolabel(sM1,sD,'vote');
som_show(sM1,'comp',comp);
%som_show_add('label',sM2.labels,'textsize',8,'textcolor','k');
%% Consensus avec STatis etude multi-blocs
VEE=struct;bmus2=struct;WW=struct;VEPU=struct;VAP=struct;
VEETilde=struct;bmus1Tilde=struct;WWTilde=struct;VEPUTilde=struct;VAPTilde=struct;
for k=1:Appr
disp(k)
%%
for b=1:B
EnsPartition(b,:)=RFusion(k).Result(b).clust(:,2);
end
%%initialisation
[VEE.App(k).res,bmus2.App(k).res,WW.App(k).res,VEPU.App(k).res, VAP.App(k).res] = StatisFunction(EnsPartition, nb_class,Critere, 1);
PureteR(k)= comparaison_partitionOM(Label,bmus2.App(k).res);
%% Consensus CSTATIS avec la matrice des z_tilde
for b=1:B
H_matrix(b).matrix=RFusion(k).Result(b).Z_tilde;
end
[VEETilde(k).res, bmus1Tilde(k).res,WWTilde(k).W,VEPUTilde(k).res, VAPTilde(k).res, STilde(k).res]=StatisFunction( H_matrix, nb_class, Critere, 2 );
PerfZtilde(k)=comparaison_partitionOM(Label,bmus1Tilde(k).res);
% CSPA Tilde
%YTilde = pdist(RFusion(k).Z_Directe,'euclid');
%ZTilde = linkage(YTilde,'ward');
%TTilde = cluster(ZTilde,'maxclust',nb_class);
%PureteBlocCSPATilde(k)=comparaison_partitionOM(Label,TTilde);