Saving Feature in Bessy

An expansion of the spike on Session Saves by Brian

Problem

The current version of BCI Essentials (Bessy) has no features for saving data from a BCI session. We are interested in saving the trained classifier object within the Python (BessyPy) backend and being able to restore a trained classifier object from the Unity (BessyU) frontend.

Definitions

Proposed solution

Add 4 new methods to Bessy to enable saving and loading of the classifier objected being used in online mode:

  1. BessyPy.save_classifier: A method to save the classifier located within the EEG_data and ERP_data object in both online and offline mode. This would use Python pickle to write the classifier object from the Python interpreter’s memory to local storage.
  2. BessyPy.load_classifier: A method to load a saved classifier into the EEG_data or ERP_data object in online mode. This would use Python pickle to load a classifier object from local storage into the Python interpreter’s memory
  3. BessyU: A method to activate BessyPy.save_classifier so that this function can be mapped to a button or UI object.
  4. BessyU: A method to activate BessyPy.load_classifier so that this function can be mapped to a button or UI object.

Use cases

Being able to save and restore the trained classifier will be helpful in at least two use cases, with Case A being a higher priority:

Case A: Computer failure. A computer failure, whether at the hardware or software level, will result in total loss of data within Bessy. As a result, a session will have to be restarted from scratch including the time-consuming calibration phase. Being able to restore a session by loading the already-trained classifier would be immensely helpful for both BCI Operators and BCI Users.

Case B: User Profiles. BCI Operators may want to save a BCI Users trained classifier, as this would allow an Operator to restore from a specific previously trained classifier, compare classifiers between sessions, or use a BCI User’s previously trained classifiers for Transfer Learning.

Feature roadmap

Version 1: Manual saving of trained classifier

Version 2: Automatic saving of trained classifier

Additions by Brian on April 28, 2025:

Version 3: User profiles that manages history of stored classifiers