Skip to content

ErikBjare/thesis

Repository files navigation

MSc Thesis

GitHub Actions badge Code coverage Typechecking: Mypy Code style: black

My MSc thesis on "Classifying brain activity using electroencephalography and automated time tracking of computer use".

Progress was tracked using GitHub issues and the GitHub Projects board.

Abstract

We investigate the ability of EEG to distinguish between different activities users engage in on their devices, building on previous research which showed a considerable difference in brain activity between code- and prose-comprehension, as well as differences during code- and prose-synthesis. We perform a replication study and improve upon past results using state-of-the-art machine learning classifiers based on Riemannian geometry.

Furthermore, we extend the scope of previous work by introducing the automated time tracking application ActivityWatch, to track the device activities that the user is engaging in. This lets us label EEG data with naturalistic device activity, which we then use to train classifiers to discern activities such as code writing vs prose writing, or work vs media consumption. Our results indicate that a consumer-grade EEG device can discern between different activities that a user performs at the computer. Among other results, we show that not only can code and prose comprehension be distinguished, but also code and prose writing.

Writing

The latest version of the writing can be downloaded at:

Usage

Setting it up:

  • Ensure you have Python 3.7+ and poetry installed
  • Install dependencies with poetry install

Collecting data:

  • Run eegwatch --help for instructions on how to collect EEG data
  • Run ActivityWatch to collect device activity data
  • Run the codeprose task in eeg-notebooks to collect data for the code vs prose task
    • Install eeg-notebooks with pip install git+
    • Run the codeprose task with eegnb runexp -ex visual-codeprose -subject X

Running classifier:

  • Run ./scripts/query_aw.py to collect labels from the running ActivityWatch instance
    • You probably want to adjust the categorization rules embedded in the file
  • (TODO) Run eegclassify --help for instructions on how to train and run the classifier

Devices

I've worked with multiple devices, but the experiments were performed using the Muse S, which is therefore the best-supported device.

  • Muse S
    • PPG support (experimental)
  • Neurosity Notion 1 & 2
  • Neurosity Crown
  • OpenBCI Cyton
  • In theory: any device supported by Brainflow or muse-lsl

Notebooks

Code notebooks are built in CI and available at:

  • Main - primary notebook for the thesis, where we train a classifier for the code vs prose comprehension task.
  • Signal - for signal filtering and quality checking.
  • Activity - for classification of device activities.
  • PPG - for a basic PPG analysis.

Acknowledgements

See the Acknowledgements section in the thesis.

About

MSc thesis on: Classifying brain activity using EEG and automated time tracking of computer use (using ActivityWatch)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published