Skip to content

A flexible POMDP approach used as a decision process for three types of active / re-active BCI

Notifications You must be signed in to change notification settings

neuroergoISAE/POMDP-BCI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

POMDP-BCI

Python scripts of the implementation of a Partially Observable Markov Decision Process (POMDP) used for sequential decision-making on three different BCI approaches using: steady-state visually evoked potentials (SSVEP), code visually evoked potentials (CVEP), and motor imagery (MI).

The pomdp implementation depends on the pomdp-py package for Python. The data used on the different analyses is available online:

  • In the case of SSVEP and MI experiments, the datasets are accessed directly from their corresponding scripts using the MOABB Python package
  • For the CVEP experiment, the dataset is available on Zenodo

Disclaimer and reproducibility

This repository is the public codebase of a work-in-progress research project. As such, file structure and code organization may evolve as new approaches are tested and publications are written. In order to ensure reproducibility of all works related to this project, a github release corresponding to each scientific publication will be made available. Please consult the releases page to find the corresponding release to the publication whose results you are interested in testing or working from. As this repository is not the one where the code is developed, there is a possibility that the releases contain minor bugs related to filenames or file organization, which may be different in the original repository. If you encounter any bugs trying to run the code contained in this repository, please open an issue so the bugs can be fixed as soon as possible.

Dependencies

Here we detail all the necessary packages and utilities to run the contents of the repo.

Python Dependencies

  • Cython
  • Pomdp_py
  • Pyriemann
  • Mne
  • Moabb
  • Tensorflow
  • Tensorflow-addons

This project was tested to run on Python 3.7 installed using Anaconda. Required packages can be installed using pip:

$ pip install cython pomdp_py pyriemann mne moabb tensorflow==2.11.0 tensorflow-addons

It is also needed to pip install this package in order for the scripts to work:

git clone https://github.com/neuroergoISAE/POMDP-BCI.git
cd POMDP-BCI
pip install -e .

Note: The CVEP experiment uses a CNN that can be trained using your GPU with Tensorflow. In order to do that, please refer to the Tensorflow documentation on the section 'GPU setup'. Refer to this table in order to know which version of Cuda works with your Tensorflow version. This project uses version 2.11.0.

Other Dependencies

The POMDP model presented in this repo uses the SARSOP implementation from this Github repo through the interface provided by pomdp_py (check the documentation for details).

In order to use it for our POMDP, SARSOP needs to be built from the repo and its path specified on the script that uses it. Instructions for building the libraty can be found on the SARSOP repository, while instructions on how to set the path and call the sarsop pomdp_py functioncan be found in the pomdp_py documentation, both linked above.

File structure

├── pomdp_bci
│   ├── __init__.py
│   ├── domain
│   ├── models
│   ├── problem.py
│   ├── config
│   ├── experiment.py
│   ├── ssvep_exp.py
│   ├── cvep_exp.py
│   ├── ssvep_pomdp.py
│   ├── cvep_pomdp.py
│   ├── mi_pomdp.py
│   └── utils
├── README.md
└── setup.py

All the necessary code to run the experiments can be found inside the pomdp_bci folder:

  • The folders domain and models, together with problem.py contain the code that defines the POMDP model.
  • The folder plots contains the code to generate figures relative to the results of the experiments, as well as LaTeX tables
  • The file experiment.py contains the abstract class for the common BCI-POMDP analysis, with all methods that are shared among datasets and BCI modalities. Each analysis file (ssvep.py and cvep.py) implement their own version of the relevant analysis methods. This allows for simple iteration among different variations of parameters for the analysis.
    • Each analysis file has a corresponding .json file with parameters required for the analysis, such as the number of subjects in the dataset. They can be found in the config folder.
  • The utils folder is preserved for backwards compatibility, and for the interfaces of TRCA and cvep's neural network. Most of the utility functions have been moved to experiment.py

About

A flexible POMDP approach used as a decision process for three types of active / re-active BCI

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages