Skip to content

Minicourse EDTH-JB12

Hands-on machine learning with fNIRS using the BenchNIRS Python framework

Johann Benerradi

with Borja Blanco Maniega, Jeremie Clos, Katharine Lee

About this course

While machine learning with neuroimaging data has become very popular in the past couple of years, it remains a difficult set of techniques to use. It can, therefore, be challenging to implement machine learning models for the classification of fNIRS data (e.g., for brain-computer interface applications) but also to evaluate them in a robust way that will reflect the performance when used on new data (generalization capabilities).

In this minicourse, we will teach how to use BenchNIRS (, which is an open-source Python framework that facilitates both the development and the evaluation of machine learning (including deep learning) models for the classification of fNIRS data (see Benerradi et al., 2023 for more details). After an introduction to machine learning with fNIRS and a presentation of the challenges related to its development and evaluation, we will guide the attendees to using BenchNIRS with Python on their own computer for 1) evaluating existing machine learning models for task classification from fNIRS data on open access datasets, and; 2) creating, training, optimizing and evaluating a deep learning model on an fNIRS dataset.

Participants will need to bring their own laptops (with Windows, MacOS, or Linux) in order to follow along.

Learning Outcomes

Participants will acquire:

  • basic knowledge of machine learning with fNIRS;
  • awareness of best practices when developing and evaluating machine learning models with fNIRS;
  • practical skills for evaluating machine learning models in the context of classification using fNIRS data;
  • practical skills for developing deep learning models for fNIRS data classification.

Course Plan

Level: Introductory

No knowledge of Python is required. However, minimal programming skills are preferred (familiarity with concepts of variables, loops, using functions)
Course Duration: 3 hours

Delivery Plan

60 min: intro to machine learning with fNIRS, machine learning classification evaluation, challenges and best practices
30 min: software installation and hands-on machine learning evaluation with BenchNIRS
60 min: using BenchNIRS with the practical example of implementing a deep learning model, training the model and optimizing it, evaluating the model
30 min: open discussion, and reflection about bias in machine learning with fNIRS

Why enrol on this course?

This minicourse will introduce machine learning for fNIRS data classification by using BenchNIRS, an open-source Python framework. This framework makes it easier to develop machine learning models (including deep learning) and evaluate them without bias on open access datasets to have an accurate estimate of the performance on unseen data, for example, for application to brain-computer interfaces.

The goals of the workshop are the following:

  • introduce machine learning (including deep learning) for fNIRS and its applications
  • present different ways to evaluate machine learning classification models
  • present best practices and explain the challenges when it comes to developing and evaluating machine learning models for fNIRS and therefore the need for a robust evaluation
  • help the attendees with the installation of Python and the required libraries for machine learning with fNIRS
  • show how to make a dataset compatible with BenchNIRS (including datasets initially processed using MATLAB)
  • guide the attendees through the evaluation of existing machine learning models on open-access datasets using BenchNIRS
  • explore the development and training of deep learning models for fNIRS on open-access datasets using BenchNIRS