diff --git a/text/TODO.txt b/text/TODO.txt index 4dfbae3..f07e85a 100644 --- a/text/TODO.txt +++ b/text/TODO.txt @@ -101,4 +101,4 @@ ---------- BCI2000 - what does the signal values (int) mean? via... -"our work" - better idea? +mean on EMG? diff --git a/text/thesis/02MaterialsAndMethods.tex b/text/thesis/02MaterialsAndMethods.tex index 429ee8b..eb6940b 100644 --- a/text/thesis/02MaterialsAndMethods.tex +++ b/text/thesis/02MaterialsAndMethods.tex @@ -156,6 +156,8 @@ \subsection{Regression} Regression is the idea of finding $A$ so that $$Ax=y,$$ where x is the input and y the output of a system. Having this $A$ from any given input the output can be predicted. %TODO \subsubsection{RIDGE-Regression} + \subsection{Cross Validation} + %TODO \section{Experimental design} The data used for this work were mainly recorded by Farid Shiman, Nerea Irastorza-Landa, and Andrea Sarasola-Sanz for their work (\cite{Shiman15},\cite{Sarasola15}). We were allowed to use them for further analysis.\\ There were 9 right-handed subjects with an average age of 25 (variance 6.67, minimum 20, maximum 28). Three female and 6 male subjects were tested. All the tasks were performed with the dominant right hand.\\ @@ -173,7 +175,7 @@ One session consists of 5 runs with 40 trials each. The trials were separated by resting phases of varying length (2-3s, randomly assigned). Each trial began with an auditory cue specifying the random but equally distributed target for this trial. This leads to 50 reaches to the same target each session. After the cue the participants should \qq{perform the movement and return to the starting position at a comfortable pace but within 4 seconds}\footnote{\cite{Shiman15}}\\ For each subject there were 4 to 6 sessions, each recorded on a different day. All in all there were 255 runs in 51 sessions. Each session was analyzed independently as one continuous trial. -\section{Our work} +\section{Data Acquisition} \subsection{Loading of data} The data recorded with BCI2000 (\cite{Schalk04}) can be loaded into \matlab{} with a specific \texttt{.mex} file. The according \texttt{.mex}-Files for some platforms (Windows, MAC, Linux) are available from BCI2000 precompiled.\\ We loaded the signal plus the according status data and the parameters (see Algorithm~\ref{alg:load_bcidat}). @@ -243,8 +245,6 @@ \subsubsection{Parameters} All the settings from the BCI2000 recording are saved in and loaded from the \texttt{parameters}.\\ Examples are the names of the channels, the random seed for BCI2000 and the sounds, meaning and duration for different stimuli. - \subsection{Cut Data} - %TODO? \subsection{Filtering} For filtering we used second order Butterworth filters. For normal EEG we used: @@ -264,8 +264,24 @@ \item bandstop at 48-52Hz and 148-152Hz to eliminate (possibly relevant) power line noise \end{enumerate} For filtering we used \matlab{}s \texttt{filtfilt} function to reduce shift due to multiple filtering steps. + \subsection{Windowing} + %TODO? \subsection{Waveform length} For the representation of EMG data we used waveform length as described by Phinyomark et al. in \cite{Phinyomark12} which gives a measurement for the change in the window. It is calculated as the sum over the absolute difference of consecutive measurements in the time window: $$\sum\limits_{i=1}^N \left| x_i-x_{i-1}\right|,$$ where $N$ is the number of measurements in the time window and $x_i$ are the measurements themselves.\\ It describes the length of the way of a needle plotting the EMG on a self-moving band. + \subsection{Classification} + \label{sec:newClass} + Very bad results when classifying EMG into Move/Rest made us further inspect the data. The actual movement came quite a while after the stimulus.\\ + To address this problem we did a re-classification of the data according to actual movements (cf. Appendix~\ref{code:classify}). To decide whether the subject is moving or not we compared the mean EMG activity (from Waveform Length) to a threshold (10,000 by default).\\ + If there was movement we defined the class occurring most in the second before as the current task. If there was movement but the stimulus told to rest, we assigned the last active stimulus.\\ + In addition we took the second before movement onset out of the data (classified as -1) and (optionally) half a second before movement onset as belonging to the following stimulus.\\ + Finally we did some smoothening by taking the most occurring class one second before to one second after the current time step as its class.\\ + As last step we adjusted the length of the stimulus-vector to the length of the EEG data.\\ + According to this classification we took only data in the further analysis which were classified different than -1 meaning they are either clear rest or clear movement. +%TODO +\section{Data Analysis} + \subsection{Classification} + Classification can be done in different ways. First approach was discriminating Movement from Rest. This was done by training an SVM and testing its results with 10-fold cross validation. This was done with EMG, EEG and LF data. EMG in this setting is trivial since it was the basis for the classification (cf. \ref{sec:newClass}).\\ + In a second step we tried to discriminate movement in different directions also with an SVM trained on EMG, EEG or LF data respectively. The fit of the model was also checked with 10-fold cross validation. diff --git a/text/thesis/Bfunctions.tex b/text/thesis/Bfunctions.tex index ce9f1f8..cc28b49 100644 --- a/text/thesis/Bfunctions.tex +++ b/text/thesis/Bfunctions.tex @@ -1,3 +1,19 @@ \chapter{Documentation of \matlab{}-Code} -\texttt{callAll.m} +\section{\texttt{callAll.m}} +\section{Data Acquisition} +\subsection{\texttt{classifyAccordingToEMG.m}} +\label{code:classify} +\subsection{\texttt{readAll.m}} +\label{code:readAll} +\subsection{\texttt{readAllPos.m}} +Same as \ref{code:readAll} but using position instead of movement from kinematics data. +\subsection{\texttt{generateTrainingData.m}} +\label{code:generate} +\subsection{\texttt{generateTrainingDataPos.m}} +Same as \ref{code:generate} but using position instead of movement from kinematics data. +\section{Data Analysis} + +\section{Plots} + +\section{miscellaneous} diff --git a/text/thesis/mylit.bib b/text/thesis/mylit.bib index e98a327..4deb475 100755 --- a/text/thesis/mylit.bib +++ b/text/thesis/mylit.bib @@ -173,7 +173,7 @@ } @article{Spyers98, author = "J.M. Spyers-Ashby and P.G. Bain and S.J. Roberts", - title = "A comparison of fast fourier transform (FFT) ans autoregressive (AR) spectral estimation techniques fir the analysi of tremor data", + title = "A comparison of fast Fourier transform (FFT) and autoregressive (AR) spectral estimation techniques for the analysis of tremor data", year = "1998", journal = "Journal of Neuroscience Methods", volume = "83", diff --git a/text/thesis/outline.txt b/text/thesis/outline.txt index a2ea06f..eb7ed88 100644 --- a/text/thesis/outline.txt +++ b/text/thesis/outline.txt @@ -27,7 +27,7 @@ - Filtering of EEG - Classification - new Classification - - thershold for Movement (Histogram) + - threshold for Movement (Histogram) - Movement - Rest - different Movements - prediction kinematics @@ -38,7 +38,6 @@ - Autoencoder - How many synergies? (4 but 3) - topographical plots - - LF - Parameters - timing, ... - SVM diff --git a/text/thesis/thesis.tex b/text/thesis/thesis.tex index a3c127d..04d17f6 100644 --- a/text/thesis/thesis.tex +++ b/text/thesis/thesis.tex @@ -184,6 +184,8 @@ \begin{tabbing} \textbf{EEG}\hspace{1cm}\=Electroencephalography\\ +\textbf{EMG}\hspace{1cm}\=Electromyography\\ +\textbf{LF}\hspace{1cm}\=Low Frequency\\ \textbf{BCI}\> Brain-Computer-Interface \\ \textbf{SVM}\> Support-Vector-Machine \\ \textbf{ECoG}\> Electrocorticography \\ @@ -265,7 +267,6 @@ \vskip 3cm Tübingen, 30.10.2016 \hfill \author \hfill -\cleardoublepage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% Ende %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%