diff --git a/evaluation.mat b/evaluation.mat index 006f5a6..9750f23 100644 --- a/evaluation.mat +++ b/evaluation.mat Binary files differ diff --git a/text/TODO.txt b/text/TODO.txt index 5684f44..0cde0b7 100644 --- a/text/TODO.txt +++ b/text/TODO.txt @@ -113,6 +113,7 @@ ---------- bad results for move/rest * compare with pause +svmCV (only 0.1,1,10) diff --git a/text/thesis/02MaterialsAndMethods.tex b/text/thesis/02MaterialsAndMethods.tex index 6d8861e..06f45c5 100644 --- a/text/thesis/02MaterialsAndMethods.tex +++ b/text/thesis/02MaterialsAndMethods.tex @@ -337,6 +337,7 @@ As last step we adjust the length of the stimulus-vector to the length of the EEG data.\\ According to this classification we take only data in the further analysis which are classified different than -1 meaning they are either clear rest or clear movement. \subsection{Synergies} + \label{mat:synergies} Synergies we generate based on different options for dimensionality reduction (cf. \ref{back:synergies}).\\ EMG data (as wave length) is reduced to $n$ dimensions, where $n$ is the desired number of Synergies.\\ Using PCA this is done by taking the first $n$ components. Then the EMG data is transformed into the $n$-dimensional space spanned by the components.\\ diff --git a/text/thesis/03Results.tex b/text/thesis/03Results.tex index 24db644..bdd589c 100644 --- a/text/thesis/03Results.tex +++ b/text/thesis/03Results.tex @@ -62,3 +62,92 @@ \caption{Classification with LF-data} \label{fig:overviewLF} \end{figure} + \subsection{Trade-off parameter} + With a cross validation we compare the results for the soft-margin parameter for $\lambda=0.1,1,10$. The results are shown in figure~\ref{fig:svmCV}. +\section{Regression} + \subsection{Comparison of methods of recording} + \subsubsection{Velocities} + Predicting velocities from EEG, EMG and Low Frequencies is significantly\footnote{$p\approx1.4\exp{-65}$} pairwise different (cf. figure~\ref{fig:corrEEGemgLF}). The corresponding $p$-Values of the ANOVA are given in table~\ref{tab:pCorr}. + \begin{figure} + \centering + \includegraphics[width=0.9\textwidth]{pictures/results/corrEEGemgLF.png} + \caption{EEG, EMG and LF compared based on prediction of velocities} + \label{fig:corrEEGemgLF} + \end{figure} + \begin{table} + \centering + \begin{math} + \begin{array} + {r||c|c|c} + &EEG&EMG&LF\\\hline + EEG&-&4.7\exp{-17}&3.7\exp{-55}\\ + EMG&4.7\exp{-17}&-&1.2\exp{-7}\\ + LF&3.7\exp{-55}&1.2\exp{-7}&- + \end{array} + \end{math} + \caption{$p$-Values for prediction of velocities from EEG, EMG or LF respectively} + \label{tab:pCorr} + \end{table} + \subsubsection{Positions} + Predicting positions from EEG, EMG and Low Frequencies is significantly\footnote{$p\approx2.1\exp{-223}$} different, however not pairwise (cf. figure~\ref{fig:corrEEGemgLFpos}). Positions predicted from EMG and LF are not significantly different. The corresponding $p$-Values of the ANOVA are given in table~\ref{tab:pCorrPos}. + \begin{figure} + \centering + \includegraphics[width=0.9\textwidth]{pictures/results/corrEEGemgLFpos.png} + \caption{EEG, EMG and LF compared based on prediction of positions} + \label{fig:corrEEGemgLFpos} + \end{figure} + \begin{table} + \centering + \begin{math} + \begin{array} + {r||c|c|c} + &EEG&EMG&LF\\\hline + EEG&-&3.2\exp{-91}&2.3\exp{-204}\\ + EMG&3.2\exp{-91}&-&0.34\\ + LF&2.3\exp{-204}&0.34&- + \end{array} + \end{math} + \caption{$p$-Values for prediction of positions from EEG, EMG or LF respectively} + \label{tab:pCorrPos} + \end{table} + \subsection{Compare Prediction direct and via Synergies} + \subsubsection{Velocities} + There is a significant\footnote{$p\approx1.7\exp{-24}$} difference between the predictions. The different synergies however have no significant difference ($p\approx0.87$). Also see figure~\ref{fig:directVia}. + \begin{figure} + \centering + \includegraphics[width=\textwidth]{pictures/results/predictKinfromEEG.png} + \caption{Velocities predicted from EEG direct or via Synergies} + \label{fig:directVia} + \end{figure} + \subsubsection{Positions} + There is a significant\footnote{$p\approx2.7\exp{-146}$} difference between the predictions. The different synergies however have no significant difference ($p\approx0.85$). Also see figure~\ref{fig:directViaPos}. + \begin{figure} + \centering + \includegraphics[width=\textwidth]{pictures/results/predictPosfromEEG.png} + \caption{Positions predicted from EEG direct or via Synergies} + \label{fig:directViaPos} + \end{figure} + \subsection{EEG} + \subsubsection{Offset} + Offset makes no significant difference when predicting Synergies\footnote{Autoencoder: $p\approx0.81$, PCA: $p\approx0.77$, NMF: $p\approx0.60$} or velocities ($p\approx0.99$) or positions ($p\approx0.98$). + \subsubsection{Pause} + Whether there is a pause of 1s or only 0.5s doesn't make a significant difference for Autoencoder ($p\approx0.13$), PCA ($p\approx0.29$), NMF ($p\approx0.054$) or Velocities ($p\approx0.95$). + \subsection{EMG} + Using a offset or not does not make any difference since the offset is only applied on EEG-data (cf. \ref{mat:offset}).\\ + Predicting synergies from EMG does not make sense since they are computed from EMG (cf. \ref{mat:synergies}).\\ + \subsubsection{Pause} + There is no significant effect of the use of a pause when predicting velocities from EMG ($p\approx0.90$). + \subsection{Low Frequencies} + \subsubsection{Offset} + Offset makes no significant difference for predicting Autoencoder ($p\approx0.50$), PCA ($p\approx0.59$), NMF ($p\approx0.38$), velocities ($p\approx0.97$) or position ($p\approx1.0$). + \subsubsection{Pause} + There is no effect of pause for velocities from low frequencies ($p\approx0.73$).\\ + However there is an effect for Autoencoder ($p\approx3.2\exp{-6}$), PCA ($p\approx0.0001$) and NMF ($p\approx3.7\exp{-9}$). + + The plot shows a better performance with a shorter pause and more data taken in (see figure~\ref{fig:lfToAutoencPause}) + \begin{figure} + \centering + \includegraphics[width=\textwidth]{pictures/results/lfToAutoencPause.png} + \caption{Autoencoder data predicted from Low Frequencies} + \label{fig:lfToAutoencPause} + \end{figure} diff --git a/text/thesis/04Discussion.tex b/text/thesis/04Discussion.tex new file mode 100644 index 0000000..ec1341a --- /dev/null +++ b/text/thesis/04Discussion.tex @@ -0,0 +1 @@ +\chapter{Discussion} diff --git a/text/thesis/05Future.tex b/text/thesis/05Future.tex new file mode 100644 index 0000000..10600d3 --- /dev/null +++ b/text/thesis/05Future.tex @@ -0,0 +1,3 @@ +\chapter{Future Work} + \section{new Data set} + Are the results different because of the new classification? diff --git a/text/thesis/pictures/results/corrEEGemgLF.png b/text/thesis/pictures/results/corrEEGemgLF.png new file mode 100644 index 0000000..04cc81d --- /dev/null +++ b/text/thesis/pictures/results/corrEEGemgLF.png Binary files differ diff --git a/text/thesis/pictures/results/corrEEGemgLFpos.png b/text/thesis/pictures/results/corrEEGemgLFpos.png new file mode 100644 index 0000000..9ae3e86 --- /dev/null +++ b/text/thesis/pictures/results/corrEEGemgLFpos.png Binary files differ diff --git a/text/thesis/pictures/results/lfToAutoencPause.png b/text/thesis/pictures/results/lfToAutoencPause.png new file mode 100644 index 0000000..82b83fc --- /dev/null +++ b/text/thesis/pictures/results/lfToAutoencPause.png Binary files differ diff --git a/text/thesis/pictures/results/predictKinfromEEG.png b/text/thesis/pictures/results/predictKinfromEEG.png new file mode 100644 index 0000000..ca42e37 --- /dev/null +++ b/text/thesis/pictures/results/predictKinfromEEG.png Binary files differ diff --git a/text/thesis/pictures/results/predictPosfromEEG.png b/text/thesis/pictures/results/predictPosfromEEG.png new file mode 100644 index 0000000..8b58174 --- /dev/null +++ b/text/thesis/pictures/results/predictPosfromEEG.png Binary files differ diff --git a/text/thesis/thesis.tex b/text/thesis/thesis.tex index a4bb5a8..ce66066 100644 --- a/text/thesis/thesis.tex +++ b/text/thesis/thesis.tex @@ -28,6 +28,7 @@ \newcommand{\qq}[1]{``#1''} +\renewcommand{\exp}[1]{\ensuremath{\cdot10^{#1}}} \textwidth 14cm \textheight 22cm @@ -219,13 +220,13 @@ \input{03Results} \cleardoublepage -%% Discussion -% \input{04Discussion} -% \cleardoublepage +% Discussion +\input{04Discussion} +\cleardoublepage -%% future work -% \input{05Future} -% \cleardoublepage +% future work +\input{05Future} +\cleardoublepage %%Appendix \appendix diff --git a/usedMcode/evaluation.m b/usedMcode/evaluation.m index 00b7f92..3e9ad9e 100644 --- a/usedMcode/evaluation.m +++ b/usedMcode/evaluation.m @@ -1,5 +1,7 @@ load('/home/jph/Uni/masterarbeit/evaluation.mat') +% the data for the corresponding setting has to be loaded + accuracys.EEG.(sprintf('%s',name))=meanAccuracysEEG; accuracys.EMG.(sprintf('%s',name))=meanAccuracysEMG; accuracys.LF.(sprintf('%s',name))=meanAccuracysLF; @@ -23,6 +25,19 @@ correlations.EMG.pos.(sprintf('%s',name))=correlationEMGpos; correlations.LF.pos.(sprintf('%s',name))=correlationLFpos; +correlations.EEG.emg.Default=correlationEEGemg; +correlations.EEG.kin.ViaAutoenc=correlationViaAutoenc; +correlations.EEG.kin.ViaNNMF=correlationViaNNMF; +correlations.EEG.kin.ViaPCA=correlationViaPCA; + +correlations.Autoenc.kin.Default=correlationAutoencKin; + + +correlations.EEG.pos.ViaAutoenc=correlationViaAutoenc; +correlations.EEG.pos.ViaNNMF=correlationViaNNMF; +correlations.EEG.pos.ViaPCA=correlationViaPCA; + +correlations.Autoenc.pos.Default=correlationAutoencKin; save('/home/jph/Uni/masterarbeit/evaluation.mat','accuracys','correlations') clear diff --git a/usedMcode/evaluationAccuracys.m b/usedMcode/evaluationAccuracys.m index 9fe64c7..307df58 100644 --- a/usedMcode/evaluationAccuracys.m +++ b/usedMcode/evaluationAccuracys.m @@ -1,6 +1,6 @@ load('/home/jph/Uni/masterarbeit/evaluation.mat') -%compare forms of recording +%% compare forms of recording eegAcc=struct2array(accuracys.EEG); emgAcc=struct2array(accuracys.EMG); LFAcc=struct2array(accuracys.LF); @@ -10,6 +10,7 @@ ylabel('% classified correctly') title('ANOVA for EEG, EMG and LF') +%% evaluate single form of recording input=accuracys.LF; sizeY=2; limits_y=[100,0]; diff --git a/usedMcode/evaluationCorrelations.m b/usedMcode/evaluationCorrelations.m index 57eacbf..df3c7a8 100644 --- a/usedMcode/evaluationCorrelations.m +++ b/usedMcode/evaluationCorrelations.m @@ -1,6 +1,59 @@ load('/home/jph/Uni/masterarbeit/evaluation.mat') -input=correlations.EEG.Autoenc; +%% compare methods of recording +% velocities +eegCorrKin=struct2array(correlations.EEG.kin); +emgCorrKin=struct2array(correlations.EMG.kin); +LFCorrKin=struct2array(correlations.LF.kin); + +anova1([eegCorrKin,emgCorrKin,LFCorrKin],cat(1,zeros([15,1]),ones([6,1]),2*ones([15,1]))) +xlabel('EEG - EMG - LF') +ylabel('correlation recorded - predicted') +title('ANOVA for EEG, EMG and LF') +anova1([eegCorrKin,emgCorrKin],cat(1,zeros([15,1]),ones([6,1]))) +anova1([eegCorrKin,LFCorrKin],cat(1,zeros([15,1]),2*ones([15,1]))) +anova1([emgCorrKin,LFCorrKin],cat(1,ones([6,1]),2*ones([15,1]))) + +% positions +eegCorrPos=struct2array(correlations.EEG.pos); +emgCorrPos=struct2array(correlations.EMG.pos); +LFCorrPos=struct2array(correlations.LF.pos); + +anova1([eegCorrPos,emgCorrPos,LFCorrPos],cat(1,zeros([9,1]),ones([3,1]),2*ones([9,1]))) +xlabel('EEG - EMG - LF') +ylabel('correlation recorded - predicted') +title('ANOVA for EEG, EMG and LF') +anova1([eegCorrPos,emgCorrPos],cat(1,zeros([9,1]),ones([3,1]))) +anova1([eegCorrPos,LFCorrPos],cat(1,zeros([9,1]),2*ones([9,1]))) +anova1([emgCorrPos,LFCorrPos],cat(1,ones([3,1]),2*ones([9,1]))) + +%% compare direct and via +%kin +direct=correlations.EEG.kin.Default; +viaAutoenc=correlations.EEG.kin.ViaAutoenc; +viaPCA=correlations.EEG.kin.ViaPCA; +viaNNMF=correlations.EEG.kin.ViaNNMF; + +anova1([direct(:),viaAutoenc(:),viaPCA(:),viaNNMF(:)],{'direct','Autoenc','PCA','NMF'}) +ylabel('correlation recorded - predicted') +title('Compare velocity prediction direct and via') + +anova1([viaAutoenc(:),viaPCA(:),viaNNMF(:)],{'Autoenc','PCA','NMF'}) + +%pos +direct=correlations.EEG.pos.Default; +viaAutoenc=correlations.EEG.pos.ViaAutoenc; +viaPCA=correlations.EEG.pos.ViaPCA; +viaNNMF=correlations.EEG.pos.ViaNNMF; + +anova1([direct(:),viaAutoenc(:),viaPCA(:),viaNNMF(:)],{'direct','Autoenc','PCA','NMF'}) +ylabel('correlation recorded - predicted') +title('Compare position prediction direct and via') + +anova1([viaAutoenc(:),viaPCA(:),viaNNMF(:)],{'Autoenc','PCA','NMF'}) + +%% evaluate single combination +input=correlations.LF.Autoenc; sizeY=2; limits_y=[1,-1]; @@ -22,8 +75,5 @@ ylim(limits_y) end -anova1(cat(2,input.default3Syn(:),input.offset1Syn3(:),input.offset2Syn3(:),input.pause1Syn3(:),input.pause1Off1Syn3(:)),[0,0,0,1,1]) -anova1(cat(2,input.default3Syn(:),input.offset1Syn3(:),input.pause1Syn3(:),input.pause1Off1Syn3(:)),[0,1,0,1]) - -%pos only -anova1(cat(2,input.defaultPos(:),input.defaultPosOff1(:),input.defaultPosOff2(:)),[0,1,2]) +anova1(cat(2,input.Default(:),input.Offset1(:),input.Offset2(:)),[0,1,2]) +anova1(cat(2,input.Default(:),input.Offset1(:),input.Pause1(:),input.Pause1Offset1(:)),{'0.5s Pause','0.5s Pause', '1s Pause', '1s Pause'})