diff --git a/text/thesis/02MaterialsAndMethods.tex b/text/thesis/02MaterialsAndMethods.tex index 0287523..295079c 100644 --- a/text/thesis/02MaterialsAndMethods.tex +++ b/text/thesis/02MaterialsAndMethods.tex @@ -60,7 +60,7 @@ If the Fourier transform does exist, PSD can be calculated from it, e.g. as periodogram. If not, it has to be estimated. One way to do so is fast Fourier transform (FFT), another - used here - is by parametrization with an Autoregressive model (AR). For this, one assumes that there is a relationship of the spectral density between $p$ consecutive samples and the following one. This leads to an equation with only $p$ parameters which can be estimated in different ways. Here Burg's method (\texttt{pburg} from \matlab{} library) is used.\\ In Figure~\ref{fig:psd} we see the difference between autoregressive \texttt{pburg} and periodogram \texttt{pwelch} PSD estimation. \begin{figure} - \includegraphics[width=\textwidth]{psd.png} + \includegraphics[width=\textwidth]{pictures/psd.png} \caption{PSD with FFT (top) or an Autoregressive model (bottom) respectively. The signal was unfiltered EEG data from channel \textit{Cz} second run of second session with subject AO} \label{fig:psd} \end{figure} @@ -163,7 +163,7 @@ Data like that in figure~\ref{fig:kernel} are not \emph{linearly} separable. The idea here is to apply the \emph{kernel trick}.\\ The kernel trick consists of mapping the input data to a higher dimensional space and separate it there. In many applications this mapping would be computationally expensive, for SVMs however we only need to map the inner products, e.g. as $$\varphi(\vec{x_i})^T\varphi(\vec{x_j})=K(\vec{x_i},\vec{x_j}),$$ where $\varphi$ is the mapping , $x_i$ are data points and $K$ is the kernel. We do not have to compute - or even know - $\varphi$, since $K$ only depends on the original input. This is a lot less costly and can be done quite fast. Solving the SVM in a higher dimensional space also works well. - \begin{figure} + \begin{figure}[p] \input{pictures/kernel.tikz} \caption{Data separable with the kernel trick; left in the original space with features $x$ and $y$, right in the dimension where distance from the origin is shown and the data is linear separable} \label{fig:kernel} @@ -179,7 +179,7 @@ $\lambda$ decides how big the influence of the size of $\beta$ or $b$ respectively is. \subsection{Cross Validation} $k$-fold cross validation means splitting the data into $k$ equally sized parts, training the model on $k-1$ parts and validating on the remaining one (see Figure~\ref{fig:crossValidation}). - \begin{figure} + \begin{figure}[p] \includegraphics[width=\textwidth]{pictures/K-fold_cross_validation_EN.jpg} \caption{Principle of k-fold cross validation (here $k=4$)(picture by Joan.domenech91 and Fabian Flöck)} \label{fig:crossValidation} diff --git a/text/thesis/03Results.tex b/text/thesis/03Results.tex index 70f1585..2900a56 100644 --- a/text/thesis/03Results.tex +++ b/text/thesis/03Results.tex @@ -3,7 +3,7 @@ \section{EMG} \subsection{Classification} 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} + \begin{figure}[p] \centering \includegraphics[width=0.9\textwidth]{pictures/results/overviewEMGclass.png} \caption{Classification with EMG-data in different configurations: with a 1s pause (top left) and in default configuration (top right) classifying into 5 classes and in default (bottom left) and pause (bottom right) configuration classifying Move and Rest only} @@ -31,7 +31,7 @@ \section{EEG} \subsection{Classification} Figure~\ref{fig:overviewEEG} shows the different settings for classification based on EEG-data. 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} + \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/overviewEEGclass.png} \caption{Classification with EEG-data in different configurations: default (top left), 1s pause (top, 2nd from left), pause and offset of 1 (top, 3rd from left), offset of 1 only (top right), offset of 2 (bottom left), default but classifying Move and Rest only (bottom mid) and classifying Move and Rest with 1s Pause (bottom right)} @@ -42,7 +42,7 @@ \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/cmEEGfull.png} - \caption{Confusion Matrix in default configuration for EEG} + \caption{Confusion Matrix in default configuration for EEG, right classification is more likely than any other class} \label{fig:cmEEGFull} \end{figure} \subsection{Regression} @@ -54,7 +54,7 @@ Whether there is a pause of 1s or only 0.5s makes no significant difference for Autoencoder ($p>0.1$), PCA ($p>0.1$), NMF ($p>0.1$) or Velocities ($p>0.1$). \subsubsection{EMG} For comparison also EMG was predicted from EEG. The results are shown in figure \ref{fig:EEGemg}. There are no significant differences between the channels ($p>0.1$). - \begin{figure} + \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/EEGemg.png} \caption{Prediction of the 6 EMG-channels from 32 EEG-channels; the means of the channels are not significantly different from each other} @@ -63,7 +63,7 @@ \section{Low Frequencies} \subsection{Classification} 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} + \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/overviewLFclass.png} \caption{Classification with LF-data in different configurations: 1s pause (top left), default (top, 2nd from left), pause and offset of 1 (top, 3rd from left), offset of 1 only (top right), offset of 2 (bottom left), default but classifying Move and Rest only (bottom mid) and classifying Move and Rest with 1s Pause (bottom right)} @@ -74,7 +74,7 @@ \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/cmLFfull.png} - \caption{Confusion Matrix in default configuration for Low Frequencies} + \caption{Confusion Matrix in default configuration for Low Frequencies; discrimination between move and rest is problematic, which movement is done is classified quite good} \label{fig:cmLFFull} \end{figure} \subsection{Regression} @@ -87,7 +87,7 @@ 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} + \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/lfToAutoencPause.png} \caption{Autoencoder data predicted from Low Frequencies without (left) and with pause (right)} @@ -96,7 +96,7 @@ \section{Comparison of methods of recording} \subsection{Classification} 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} + \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/classEEGemgLF.png} \caption{EEG, EMG and LF compared based on classification accuracy with 5 classes} @@ -299,35 +299,35 @@ \end{table} \subsubsection{Comparison with EMG} When compared to the original 6D EMG data as a predictor a 3D autoencoder is only significantly worse at predicting positions ($p<0.05$), not for velocities ($p>0.1$). - \begin{figure} + \begin{figure}[p] \includegraphics[width=\textwidth]{pictures/results/EMGautoencPos.png} - \caption{Predicting positions from EMG (left) or Autoencoder (right)} + \caption{Predicting positions from EMG (left) or Autoencoder (right); EMG with 6D data works slightly better} \label{fig:EMGautoencPos} \end{figure} \subsection{Compare Prediction direct and via Synergies} \label{res:differentSynergiesVia} \subsubsection{Velocities} There is a significant ($p<0.001$) difference between the predictions. The different synergies however have no significant difference ($p>0.1$). Also see figure~\ref{fig:directVia}. - \begin{figure} + \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/predictKinfromEEG.png} - \caption{Correlations for movement-velocities predicted from EEG directly or via Synergies} + \caption{Correlations for movement-velocities predicted from EEG directly or via Synergies; direct prediction works slightly better} \label{fig:directVia} \end{figure} \subsubsection{Positions} There is a significant ($p<0.001$) difference between the predictions. The different synergies however have no significant difference ($p>0.1$). Also see figure~\ref{fig:directViaPos}. - \begin{figure} + \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/predictPosfromEEG.png} - \caption{Correlations for positions predicted from EEG directly or via Synergies} + \caption{Correlations for positions predicted from EEG directly or via Synergies; direct prediction works better} \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 slightly worse (mean correlation $0.23$ (EMG) vs. $0.20$ (Autoencoder)). - \begin{figure} + \begin{figure}[p] \centering \includegraphics[width=\textwidth]{pictures/results/predictEMGfromEEG.png} - \caption{Correlations for EMG predicted from EEG directly or via Autoencoder} + \caption{Correlations for EMG predicted from EEG directly or via Autoencoder; direct prediction works slightly better} \label{fig:directViaEMG} \end{figure} \subsection{Different Synergies} @@ -336,7 +336,7 @@ \subsubsection{Prediction from EEG} Autoencoder data can be predicted better from EEG than EMG from EEG ($p<0.05$). PCA shows no significant difference ($p>0.05$). NMF data also can be predicted better ($p<0.01$).\\ An overview is shown in figure~\ref{fig:predictEMGSyn}. - \begin{figure} + \begin{figure}[p] \includegraphics[width=\textwidth]{pictures/results/predictEMGSyn.png} \caption{Predicting EMG or Synergies from EEG} \label{fig:predictEMGSyn} @@ -347,13 +347,13 @@ 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. In figure \ref{fig:topoAlpha24} the difference between two reaching movements (class 2 and 4) is shown. Here positive values stand for higher activation for class 2 and vice versa. - \begin{figure}[p] + \begin{figure} \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] + \begin{figure} \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} diff --git a/text/thesis/pictures/psd.png b/text/thesis/pictures/psd.png new file mode 100644 index 0000000..2f37ab4 --- /dev/null +++ b/text/thesis/pictures/psd.png Binary files differ diff --git a/text/thesis/psd.png b/text/thesis/psd.png deleted file mode 100644 index e25122c..0000000 --- a/text/thesis/psd.png +++ /dev/null Binary files differ diff --git a/usedMcode/psdPlot.m b/usedMcode/psdPlot.m index af7b7a7..937f1be 100644 --- a/usedMcode/psdPlot.m +++ b/usedMcode/psdPlot.m @@ -1,4 +1,8 @@ % compares pwelch and pburg +subject='AO' +number=2; +pathToFile='/home/jph/Uni/masterarbeit/origData/'; +pburgOrder=250; [sig, state, params] = load_bcidat(strcat(pathToFile,... sprintf('%s/%s_B100%i/%s_B1S00%iR02.dat',subject,subject,... number,subject,number)));