Skip to main content

Benchmarking framework for machine learning with fNIRS

Project description

BenchNIRS

BenchNIRS

Benchmarking framework for machine learning with fNIRS

Quick links
Journal article
BenchNIRS source code
Install BenchNIRS
Documentation
Examples
Issue tracker

DOI License Pipeline PyPI version

Example of figure

Features

  • loading of open access datasets
  • signal processing and feature extraction on fNIRS data
  • training, fine-tuning and evaluation of machine learning models (including deep learning)
  • production of training graphs, metrics and other useful figures for evaluation
  • benchmarking and comparison of machine learning models
  • supervised, self-supervised and transfer learning
  • much more!

Documentation

The documentation of the framework with examples can be found here.

Recommendation checklist

A checklist of recommendations towards best practices for machine learning with fNIRS can be found here. We welcome contributions from the community in order to improve it, please see below for more information on how to contribute.

Setting up BenchNIRS

  1. Download and install Python 3.9 or greater, for example with Miniconda.

  2. To install the package with pip (cf. PyPI), open a terminal (eg. Anaconda Prompt) and type:

pip install benchnirs
  1. Download the datasets (see below).

Alternatively to install from source in development mode, download and unzip the repository (or clone it with Git), and run devinstall.py.

Downloading the datasets

  • Herff et al. 2014 (n-back task): you can download the dataset by making a request here.
  • Shin et al. 2018 (n-back and word generation tasks): you can download the dataset here.
  • Shin et al. 2016 (mental arithmetic task): you can download the dataset by filling out the form here. Then click on NIRS_01-29 to download the fNIRS data.
  • Bak et al. 2019 (motor execution task): you can download the dataset here.

Keeping BenchNIRS up to date

To update BenchNIRS to the latest version with pip, open a terminal (eg. Anaconda Prompt) and type:

pip install --upgrade benchnirs

Examples

A set of example scripts showing how to use the framework can be found here.

Simple use case

BenchNIRS enables to evaluate your model in Python with simplicity on an open access dataset supported:

import benchnirs as bn

epochs = bn.load_dataset('bak_2019_me', path)
data = bn.process_epochs(epochs['right', 'left', 'foot'])
results = bn.deep_learn(*data, my_model)

print(results)

Contributing to the repository

Contributions from the community to this repository are highly appreciated. We are mainly interested in contributions to:

  • improving the recommendation checklist
  • adding support for new open access datasets
  • adding support for new machine learning models
  • adding more fNIRS signal processing techniques
  • improving the documentation
  • tracking bugs

Contributions are encouraged under the form of issues (for reporting bugs or requesting new features) and merge requests (for fixing bugs and implementing new features). Please refer to this tutorial for creating merge requests from a fork of the repository.

Acknowledgements

If you are using BenchNIRS, please cite this article:

@article{benerradi2023benchmarking,
  title={Benchmarking framework for machine learning classification from fNIRS data},
  author={Benerradi, Johann and Clos, Jeremie and Landowska, Aleksandra and Valstar, Michel F and Wilson, Max L},
  journal={Frontiers in Neuroergonomics},
  volume={4},
  year={2023},
  publisher={Frontiers Media},
  url={https://www.frontiersin.org/articles/10.3389/fnrgo.2023.994969},
  doi={10.3389/fnrgo.2023.994969},
  issn={2673-6195}
}

If you are using the datasets of the framework, please also cite those related works:

Herff et al. 2014

@article{herff2014mental,
	title={Mental workload during n-back task—quantified in the prefrontal cortex using fNIRS},
	author={Herff, Christian and Heger, Dominic and Fortmann, Ole and Hennrich, Johannes and Putze, Felix and Schultz, Tanja},
	journal={Frontiers in human neuroscience},
	volume={7},
	pages={935},
	year={2014},
	publisher={Frontiers}
}

Shin et al. 2018

@article{shin2018simultaneous,
	title={Simultaneous acquisition of EEG and NIRS during cognitive tasks for an open access dataset},
	author={Shin, Jaeyoung and Von L{\"u}hmann, Alexander and Kim, Do-Won and Mehnert, Jan and Hwang, Han-Jeong and M{\"u}ller, Klaus-Robert},
	journal={Scientific data},
	volume={5},
	pages={180003},
	year={2018},
	publisher={Nature Publishing Group}
}

Shin et al. 2016

@article{shin2016open,
	title={Open access dataset for EEG+NIRS single-trial classification},
	author={Shin, Jaeyoung and von L{\"u}hmann, Alexander and Blankertz, Benjamin and Kim, Do-Won and Jeong, Jichai and Hwang, Han-Jeong and M{\"u}ller, Klaus-Robert},
	journal={IEEE Transactions on Neural Systems and Rehabilitation Engineering},
	volume={25},
	number={10},
	pages={1735--1745},
	year={2016},
	publisher={IEEE}
}

Bak et al. 2019

@article{bak2019open,
	title={Open-Access fNIRS Dataset for Classification of Unilateral Finger-and Foot-Tapping},
	author={Bak, SuJin and Park, Jinwoo and Shin, Jaeyoung and Jeong, Jichai},
	journal={Electronics},
	volume={8},
	number={12},
	pages={1486},
	year={2019},
	publisher={Multidisciplinary Digital Publishing Institute}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

benchnirs-1.2.8.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

benchnirs-1.2.8-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file benchnirs-1.2.8.tar.gz.

File metadata

  • Download URL: benchnirs-1.2.8.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for benchnirs-1.2.8.tar.gz
Algorithm Hash digest
SHA256 0c7fecadbf2bd956d8959097d02a6c40811f2afa3bd6f6fe7649706a0811d8b4
MD5 21f6ed75f3af2fc6780898a30a2ac8cb
BLAKE2b-256 11cb20da22a4248e023040ef8a5bf3f57b4fe9aba1288dc3d38c2418223efcb8

See more details on using hashes here.

File details

Details for the file benchnirs-1.2.8-py3-none-any.whl.

File metadata

  • Download URL: benchnirs-1.2.8-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for benchnirs-1.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6e08f7c4a4558559e8616041c4ba419b397b727c70d6ae8dfbf4783c5bee4e10
MD5 14755ae8206c309e616a25118a4eae8d
BLAKE2b-256 7664d11065f8d4101bed4d7af0c248fee9ebbc6111a2f6c485a3566f682e79dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page