📄 analysesompls.m
字号:
function AnalyseSOMPLS(BestMLK,NBestMLK,MLKP,OPT,Tmax,SelVar);
[BSelect] = PlotBPLS(NBestMLK, OPT.LV, 0);
if (nargin == 6 & SelVar > 0)
NBestMLK.Ytr=NBestMLK.Ytr(:,SelVar);
BestMLK.YMap=BestMLK.YMap(SelVar,:);
BSelect=BSelect(:,SelVar);
end
if (nargin < 5)
Tmax = 1;
end
[Dummy,NvarX]=size(BestMLK.XMap);
[Nobj,Cmax]=size(NBestMLK.Ytr);
N=Nobj/Tmax;
BSelect=BSelect(1:NvarX,:);
close all
if (upper(MLKP.ProblemType) == 'REG')
for t=1:Tmax
XSel=NBestMLK.Xtr(1+(t-1)*N:t*N,1:NvarX);
YSel=NBestMLK.Ytr(1+(t-1)*N:t*N,:);
[ys,poso]=sort(YSel);
[ys,posc]=sort(BestMLK.YMap');
CT=CalcCorrTable([BestMLK.XMap; BestMLK.YMap],XSel);
for c=1:Cmax
figure(1)
subplot(Tmax,Cmax,(t-1)*Cmax+c)
imagesc(CT(:,poso(:,c))',[-1 1])
if t == 1
title('Sorted CI (XMap,Kernel)')
end
figure(2)
subplot(Tmax,Cmax,(t-1)*Cmax+c)
imagesc(XSel(poso(:,c),posc(:,c)));
if t == 1
title('Sorted Kernel')
end
colorbar
end
end
else
[ClassMap] = AssignClass(BestMLK.YMap);
LabYMap = Bin2Labs(ClassMap');
LabYtr = Bin2Labs(BestMLK.Ytr);
for t=1:Tmax
XSel=NBestMLK.Xtr(1+(t-1)*N:t*N,:);
YSel=LabYtr(1+(t-1)*N:t*N);
[ys,poso]=sort(YSel);
[ys,posc]=sort(LabYMap);
CT=CalcCorrTable(BestMLK.XMap,XSel);
figure(1)
subplot(Tmax,1,(t-1)+1)
imagesc(CT(:,poso)',[-1 1])
if t == 1
title('CI (XMap,Kernel)')
end
figure(2)
subplot(Tmax,1,(t-1)+1)
imagesc(XSel(poso,posc));
if t == 1
title('Sorted Kernel')
end
colorbar
end
end
figure(3)
subplot(1,3,1)
CT=CalcCorrTable(NBestMLK.XLoadings(1:NvarX,:)',BestMLK.YMap);
imagesc(CT)
title('CI (PLS loadings,YMap)')
colorbar
subplot(1,3,2)
CT=CalcCorrTable(BSelect',BestMLK.YMap);
imagesc(CT)
title('CI (Bcoefficients,YMap)')
colorbar
subplot(1,3,3)
CT=CalcCorrTable(NBestMLK.XLoadings(1:NvarX,:)',BSelect');
imagesc(CT)
title('CI (PLS loadings,Bcoefficients)')
colorbar
Nlv=min(5,OPT.LV);
figure(4);
for poslv=1:Nlv
[ys,posl]=sort(NBestMLK.XLoadings(1:NvarX,poslv)');
subplot(Nlv,1,poslv)
imagesc(BestMLK.XMap(:,posl)')
if poslv == 1
title('XMap sorted for PLS loading values')
end
end
figure(5)
CT=CalcCorrTable(NBestMLK.XLoadings(1:NvarX,:)',BestMLK.XMap);
subplot(3,1,1)
plot(BestMLK.Xtr')
axis tight
title('CI (XMap,PLS loadings)')
subplot(3,1,2)
imagesc(CT(1:Nlv,:))
subplot(3,1,3)
plot(CT(1:Nlv,:)')
axis tight
figure(6)
CT=CalcCorrTable(BSelect',BestMLK.XMap);
subplot(3,1,1)
plot(BestMLK.Xtr')
axis tight
title('CI (XMap,Bcoefficients)')
subplot(3,1,2)
imagesc(CT)
subplot(3,1,3)
plot(CT');
axis tight
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -