% Collection of calls to evaluate the synergies
load('/home/jph/Uni/masterarbeit/evaluation.mat')

synergies.Autoenc.Default3=correlations.EEG.Autoenc.Default;
synergies.PCA.Default3=correlations.EEG.PCA.Default;
synergies.NNMF.Default3=correlations.EEG.NNMF.Default;

synergies.Autoenc.posVia3=correlations.EEG.pos.ViaAutoenc;
synergies.PCA.posVia3=correlations.EEG.pos.ViaPCA;
synergies.NNMF.posVia3=correlations.EEG.pos.ViaNNMF;

clear correlations accuracys

%% predict Synergies from EEG
autoencData=[synergies.Autoenc.Default3,synergies.Autoenc.Default4];
pcaData=[synergies.PCA.Default3,synergies.PCA.Default4];
nnmfData=[synergies.NNMF.Default3,synergies.NNMF.Default4];

% autoencData=autoencData(4:end);
% pcaData=pcaData(4:end);
% nnmfData=nnmfData(4:end);

autoencGroup=cell(size(autoencData,2),1);
autoencGroup(:)={'Autoenc'};
pcaGroup=cell(size(pcaData,2),1);
pcaGroup(:)={'PCA'};
nnmfGroup=cell(size(nnmfData,2),1);
nnmfGroup(:)={'NMF'};
groups=cat(1,autoencGroup,pcaGroup,nnmfGroup);

% noSyn=[2,2,3,3,3,4,4,4,4,2,2,3,3,3,4,4,4,4,2,2,3,3,3,4,4,4,4];

anova1([autoencData,pcaData,nnmfData],groups)

%% Predict from predicted Synergies
autoencData=[synergies.Autoenc.posVia2,synergies.Autoenc.posVia3,synergies.Autoenc.posVia4];
pcaData=[synergies.PCA.posVia2,synergies.PCA.posVia3,synergies.PCA.posVia4];
nnmfData=[synergies.NNMF.posVia2,synergies.NNMF.posVia3,synergies.NNMF.posVia4];

autoencGroup=cell(size(autoencData,2),1);
autoencGroup(:)={'Autoenc'};
pcaGroup=cell(size(pcaData,2),1);
pcaGroup(:)={'PCA'};
nnmfGroup=cell(size(nnmfData,2),1);
nnmfGroup(:)={'NMF'};
groups=cat(1,autoencGroup,pcaGroup,nnmfGroup);

noSyn=[2,2,2,3,3,3,4,4,4,2,2,2,3,3,3,4,4,4,2,2,2,3,3,3,4,4,4];

anova1([autoencData,pcaData,nnmfData],groups)
anova1([autoencData,pcaData,nnmfData],noSyn)


%compare 3 and 4 synergies

autoencData=[synergies.Autoenc.posVia3,synergies.Autoenc.posVia4];
pcaData=[synergies.PCA.posVia3,synergies.PCA.posVia4];
nnmfData=[synergies.NNMF.posVia3,synergies.NNMF.posVia4];

% autoencData=autoencData(4:end);
% pcaData=pcaData(4:end);
% nnmfData=nnmfData(4:end);

autoencGroup=cell(size(autoencData,2),1);
autoencGroup(:)={'Autoenc'};
pcaGroup=cell(size(pcaData,2),1);
pcaGroup(:)={'PCA'};
nnmfGroup=cell(size(nnmfData,2),1);
nnmfGroup(:)={'NMF'};
groups=cat(1,autoencGroup,pcaGroup,nnmfGroup);

noSyn=[3,3,3,4,4,4,3,3,3,4,4,4,3,3,3,4,4,4];