\chapter{Results}
\label{chp:results}
\section{Number of Synergies}
\label{res:noSyn}
To determine the number of synergies to use we predicted all EMG data with each technique and each number of synergies. The result is the plot in figure~\ref{fig:noSyn}.\\
The plot tells that 2 and 4 synergies are good values for Autoencoders, for default nevertheless we use 3 synergies since we also use 3 dimensions of kinematics and so it is more comparable. Three is also the most efficient number of Synergies for PCA and NNMF (cf. Section \ref{dis:noSyn}).\\
\begin{figure}
\centering
\includegraphics[width=\textwidth,height=\textheight]{pictures/results/noSyn.png}
\caption{Self prediction accuracy with 1 to 6 synergies}
\label{fig:noSyn}
\end{figure}%TODO (last): check orientation of figure (bottom should be outer edge)
When comparing the results of prediction via different number of synergies, 2 synergies perform significantly ($p<0.01$) worse than 3 and 4. Between 3 and 4 synergies there is no significant difference ($p\approx0.1$).\\
For each method of synergy generation alone the performance of 2 synergies is not significantly ($p>0.05$) worse. Only the over-all performance with more data becomes significant.
\section{Classification}
\subsection{Comparison of methods of recording}
The different methods of recording (EEG, EMG and Low frequencies) also differ in the results. An ANOVA gives $p<0.001$ for all classifications done on 4 different movements and rest.
\begin{figure}
\centering
\includegraphics[width=\textwidth]{pictures/results/classEEGemgLF.png}
\caption{EEG, EMG and LF compared based on classification accuracy with 5 classes}
\label{fig:classEEGemgLF}
\end{figure}
The mean classification accuracys for the default run are are given in Table~\ref{tab:accs}.
\begin{table}
\centering
\begin{math}
\begin{array}
{r||c|c|c|c}
&\text{EMG}&\text{EEG}&\text{LF}&\text{chance}\\\hline
mean&60.4&40.4&32.7&20\\
std&7.97&2.27&3.35\\
max&71.9&46.7&43.4\\
min&35.7&37.2&26.2
\end{array}
\end{math}
\caption{Accuracys for the different methods of recording in default configuration}
\label{tab:accs}
\end{table}
\subsection{EMG}
In figure~\ref{fig:overviewEMG} the different settings for classification based on EMG-data are shown. Default has values as in \ref{mat:default}. The runs with pause leave out the data 1 second before the movement begins (cf. \ref{mat:pause}).
\begin{figure}
\centering
\includegraphics[width=\textwidth]{pictures/results/overviewEMGclass.png}
\caption{Classification with EMG-data}
\label{fig:overviewEMG}
\end{figure}
When calculating an ANOVA on the data with and without pause we get $p<0.001$.
\subsection{EEG}
In figure~\ref{fig:overviewEEG} the different settings for classification based on EEG-data are shown. Default has values as in \ref{mat:default}. The runs with pause leave out the data 1 second before the movement begins (cf. \ref{mat:pause}). Runs with offset have an offset of 1 or 2 (cf. \ref{mat:offset}).
\begin{figure}
\centering
\includegraphics[width=\textwidth]{pictures/results/overviewEEGclass.png}
\caption{Classification with EEG-data}
\label{fig:overviewEEG}
\end{figure}%TODO: landscape?
\subsection{Low Frequencies}
In figure~\ref{fig:overviewLF} the different settings for classification based on LowFrequency(LF)-data are shown. Default has values as in \ref{mat:default}. The runs with pause leave out the data 1 second before the movement begins (cf. \ref{mat:pause}). Runs with offset have an offset of 1 or 2 (cf. \ref{mat:offset}).
\begin{figure}
\centering
\includegraphics[width=\textwidth]{pictures/results/overviewLFclass.png}
\caption{Classification with LF-data}
\label{fig:overviewLF}
\end{figure}
\subsection{Trade-off parameter}
\label{res:maxC}
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}.\\
\begin{figure}
\caption{results of crossvalidation of the Support Vector Machine}
\label{fig:svmCV}
\end{figure}
TODO%TODO
\subsection{Confusion Matrices}
A confusion matrix shows whether there is systematic error in classification. In figure \ref{fig:cmFull} there are the confusion matrices for EEG and Low Frequency data, in figure \ref{fig:cmEMG} there is the confusion matrix for EMG data. Since EMG works well for classifying Move/Rest there is also one where only the decision is shown which movement is present. In the second plot we see that many movements are classified as class 3. Especially those belonging to class 2.
\begin{figure}[p]
\centering
\includegraphics[width=\textwidth]{pictures/results/cmEEGfull.png}
\includegraphics[width=\textwidth]{pictures/results/cmLFfull.png}
\caption{Confusion Matrices in default configuration}
\label{fig:cmFull}
\end{figure}
\begin{figure}[p]
\centering
\includegraphics[width=\textwidth]{pictures/results/cmEMGfull.png}
\includegraphics[width=\textwidth]{pictures/results/cmEMGmovements.png}
\caption{Confusion Matrices in default configuration}
\label{fig:cmEMG}
\end{figure}
\section{Regression}
\subsection{Comparison of methods of recording}
\subsubsection{Velocities}
Predicting velocities from EEG, EMG and Low Frequencies is significantly\footnote{$p<0.001$} pairwise different (cf. figure~\ref{fig:corrEEGemgLF}). The corresponding $p$-Values of the ANOVA are given in table~\ref{tab:pCorr}.\\
The over all performance is given in table \ref{tab:corrKin}.
\begin{figure}
\centering
\includegraphics[width=\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&-&<0.001&<0.001\\
EMG&<0.001&-&<0.001\\
LF&<0.001&<0.001&-
\end{array}
\end{math}
\caption{$p$-Values for prediction of velocities from EEG, EMG or LF respectively}
\label{tab:pCorr}
\end{table}
\begin{table}
\centering
\begin{math}
\begin{array}
{r||c|c|c|c}
&\text{EMG}&\text{EEG}&\text{LF}\\\hline
mean&(0.06,0.08,0.02)&(0.18,0.20,0.01)&(0.04,0.07,-0.01)\\
std&(0.05,0.05,0.02)&(0.15,0.13,0.09)&(0.05,0.05,0.04)\\
max&(0.19,0.17,0.11)&(0.49,0.49,0.21)&(0.16,0.17,0.10)\\
min&(-0.007,0.003,-0.01)&(-0.06,-0.03,-0.18)&(-0.07,-0.02,-0.08)
\end{array}
\end{math}
\caption{Correlations for the different methods of recording in default configuration predicting velocities}
\label{tab:corrKin}
\end{table}
\subsubsection{Positions}
Predicting positions from EEG, EMG and Low Frequencies is significantly\footnote{$p<0.001$} 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}.\\
The over all performance is given in table \ref{tab:corrPos}.
\begin{figure}
\centering
\includegraphics[width=\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&-&<0.001&<0.001\\
EMG&<0.001&-&0.34\\
LF&<0.001&0.34&-
\end{array}
\end{math}
\caption{$p$-Values for prediction of positions from EEG, EMG or LF respectively}
\label{tab:pCorrPos}
\end{table}
\begin{table}
\centering
\begin{math}
\begin{array}
{r||c|c|c|c}
&\text{EMG}&\text{EEG}&\text{LF}\\\hline
mean&(0.27,0.30,0.15)&(0.57,0.56,0.50)&(0.27,0.26,0.20)\\
std&(0.14,0.16,0.09)&(0.13,0.13,0.13)&(0.09,0.07,0.08)\\
max&(0.52,0.56,0.42)&(0.79,0.75,0.84)&(0.52,0.43,0.44)\\
min&(0.07,0.05,0.04)&(0.19,0.28,0.24)&(0.13,0.14,0.10)
\end{array}
\end{math}
\caption{Correlations for the different methods of recording in default configuration predicting positions}
\label{tab:corrPos}
\end{table}
\subsection{Compare Prediction direct and via Synergies}
\label{res:differentSynergiesVia}
\subsubsection{Velocities}
There is a significant\footnote{$p<0.001$} 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<0.001$} 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}
\subsubsection{EMG}
There is a significant difference between predicting EMG from EEG directly or via Autoencoders ($p<0.001$, see figure~\ref{fig:directViaEMG}). The prediction via Autoencoders performs a bit worse (mean is about 0.03 lower).
\begin{figure}
\centering
\includegraphics[width=\textwidth]{pictures/results/predictEMGfromEEG.png}
\caption{EMG predicted from EEG direct or via Autoencoder}
\label{fig:directViaEMG}
\end{figure}
\subsubsection{Different Synergies}
When predicting via synergies there is no significant difference between Autoencoder, PCA and NMF data ($p>0.85$).
\subsection{EEG}
\subsubsection{Offset}
\label{res:offsetEEG}
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.15$) or Velocities ($p\approx0.95$).
\subsubsection{EMG}
We also predict EMG from EEG. The results are shown in figure \ref{fig:EEGemg}. There are no significant differences between the channels ($p\approx0.29$).
\begin{figure}
\centering
\includegraphics[width=\textwidth]{pictures/results/EEGemg.png}
\caption{Prediction of EMG from EEG}
\label{fig:EEGemg}
\end{figure}
\subsubsection{Synergies}
Autoencoder data can be predicted better from EEG than EMG ($p<0.05$). PCA shows no significant difference ($p\approx0.07$). NMF data also can be predicted better ($p<0.01$).\\
An overview is shown in figure~\ref{fig:predictEMGSyn}.
\begin{figure}
\includegraphics[width=\textwidth]{pictures/results/predictEMGSyn.png}
\caption{Predicting EMG or Synergies from EEG}
\label{fig:predictEMGSyn}
\end{figure}
\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}
\label{res:offsetLF}
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<0.001$), PCA ($p<0.001$) and NMF ($p<0.001$).
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}
\subsection{Autoencoder}
In table~\ref{tab:corrAutoenc} the correlations for velocities and positions predicted from Autoencoder are given. The data for the Autoencoder were calculated from recorded EMG data.
\begin{table}
\centering
\begin{math}
\begin{array}
{r||c|c|c|c}
&\text{velocities}&\text{positions}\\\hline
mean&(0.05,0.08,0.01)&(0.20,0.29,0.11)\\
std&(0.04,0.05,0.02)&(0.12,0.16,0.08)\\
max&(0.18,0.17,0.08)&(0.51,0.60,0.38)\\
min&(-0.02,-0.01,-0.01)&(0.03,0.03,0.02)
\end{array}
\end{math}
\caption{Correlations for predicting velocities and positions from Autoencoder data}
\label{tab:corrAutoenc}
\end{table}
\subsubsection{Comparison with EMG}
When compared to the original 6D EMG data as a predictor a 3D autoencoder is only significantly worse when predicting positions ($p<0.05$), not for velocities ($p\approx0.23$).
\begin{figure}
\includegraphics[width=\textwidth]{pictures/results/EMGautoencPos.png}
\caption{Predicting positions from EMG or Autoencoder}
\label{fig:EMGautoencPos}
\end{figure}
\subsection{Cross-validation of Ridge Parameter}
TODO\\%TODO
For EMG we find no clear best parameter. When predicting velocities we get best parameters chosen as shown in table \ref{tab:ridgeParamEMGkin}. A 'win' refers to a run where this $\lambda$ scored the highest correlation.
\begin{table}
\centering
\begin{math}
\begin{array}
{r||c|c|c|c|c}
\lambda&0.1 & 1 & 10 & 100 & 1000\\\hline
\text{number of 'wins'} &324 & 314 & 312 & 314 & 266
\end{array}
\end{math}
\caption{Number of 'wins' for each parameter when doing ridge regression to predict velocities from EMG}
\label{tab:ridgeParamEMGkin}
\end{table}
\section{Topographical plots}
\label{res:topo}
In figure \ref{fig:topoAlpha} we see the difference between move and rest in the alpha band, in \ref{fig:topoBeta} beta band (13-20Hz) is displayed.\\
Values greater 0 stand for more activity when moving, negative values mean less activity. A value of e.g. 0.15 stands for $15\%$ higher activity when moving.
\begin{figure}[p]
\centering
\includegraphics[height=0.4\textheight]{pictures/results/topoAlpha.png}
\caption{Topographical plot of alpha band (7-13 Hz) of the difference between movement and rest for subject FS in the 3rd session}
\label{fig:topoAlpha}
\end{figure}
\begin{figure}[p]
\centering
\includegraphics[height=0.4\textheight]{pictures/results/topoBeta.png}
\caption{Topographical plot of beta band (13-20 Hz) of the difference between movement and rest for subject FS in the 3rd session}
\label{fig:topoBeta}
\end{figure}