**Dataset Overview**

The dataset for this competition contains EEG data from **four subjects**, with the following split:


**Training Set**: Data from three subjects, includes time-series EEG recordings and corresponding event labels.
**Test Set**: Data from one subject, includes time-series EEG recordings, but does not include event labels. Event labels for the test subject are *held out* and used to evaluate model quality.


**Data Collection**

The EEG data was collected using the[ IDUN Guardian Earbuds](https://iduntechnologies.com/idun-guardian) (see also this [whitepaper](https://25500273.fs1.hubspotusercontent-eu1.net/hubfs/25500273/Official%20White%20Paper%20Folder/White%20Paper%20IDUN%20Technologies.pdf)), a wearable EEG device with in-ear dry electrodes. Each subject's data includes continuous EEG signals recorded overnight while the subjects slept. The sampling rate of the data is 250 Hz, with filtering applied between 0.75 and 35 Hz (we refer to this as *raw EEG data* despite this filtering - participants are encouraged to explore additional pre-processing steps). 
The IDUN Guardian Earbuds is a single-channel in-ear EEG device that allows for prolonged monitoring of sleep-related neural activity with minimal disruption for the subjects. For this challenge, a second EEG system, with more recording channels, was used as a ground truth to confirm that events detected in the Guardian signal are correct. We *only* provide data from the IDUN Guardian.
Recordings were analyzed to manually identify the onset of various sleep and wake related neural activity signals (e.g., around REM sleep onset). 


**Task Description**
You will be provided with EEG data segmented into 30-second epochs. Each epoch is aligned to the onset of one sleep event marker (see below). Your goal is to develop a machine learning model that, given a 30s EEG epoch as input can predict the event marker associated with it. 

Note that you're given labels for the three train subjects only. You will need to use these to train an algorithm that can then *transfer* to the test subject, for whom you don't have any supervised data. The aim is to develop models that could work for any new subject without requiring additional training.

*Transfer learning* is a challenging but well-studied topic in machine learning. You can implement some of the algorithms described in the literature or develop your own! There are **7 marker types** so you will need to explore various approaches to multi-class classification while considering data preprocessing strategies for EEG data.


**Data Composition**

**Epochs**: Data is segmented into 30-second epochs. Each epoch corresponds to a specific sleep event (if any), such as sleep spindles, K-complexes, or REM sleep. 
**Labels**: Each epoch has a label which indicates the sleep event associated to it. Labels are provided as "strings" 
with the event marker (see below).

**Events (Markers)**

The seven possible sleep events in the dataset are:
```text
    SS: Sleep Spindles
    K: K-Complexes
    REM: Rapid Eye Movements
    Son: Sleep Onset
    Soff: Sleep Offset
    A: Arousals
    MS: Microsleep
```

**Continuous EEG data**: we provide data cut into epochs for convenience. The final submission for this challenge will have to be made using data organized into epochs. However, we also provide the "un-cut" data (continuous EEG recording over an entire night and associated markers timestamps). This is intended to be used by participants wishing to apply pre-processing steps to the EEG data that don't work well with data already cut into epochs. We have example code [here](https://github.com/BCI-I/BCII-IDUN-Challenge-tutorials) showing how to organize the continuous EEG data into epochs for fitting ML models and preparing a submission file. 


**Baseline Models and Code**

To help participants get started, we provide:

- Starter code for data exploration, preprocessing guidance, and visualization of the class distributions.
- Baseline models to give you a sense of initial performance, some of the main pitfalls in approaching this challenge and inspire your model development.
- Detailed instructions on how to prepare and format your submission.

Check out the example code [here](https://github.com/BCI-I/BCII-IDUN-Challenge-tutorials).

Feel free to experiment with preprocessing techniques, feature extraction, and model optimization to create an effective classification pipeline.



## Tutorials and other useful materials 
[Competition-specific tutorials](https://github.com/BCI-I/BCII-IDUN-Challenge-tutorials)

- **Useful Resources and Toolboxes**:
  - [MNE Python Library](https://mne.tools/stable/index.html) for comprehensive EEG data analysis tools.
  - [pyRiemann Library](https://pyriemann.readthedocs.io/en/latest/index.html) for covariance matrix manipulation and classification in Riemannian space.
  - [Analysing EEG Data with MNE Tutorial](https://kel-github.github.io/), covering various aspects of EEG processing.

### Tips for success!
- **Multi-Class Machine Learning Challenge**: Participants will tackle a multi-class classification problem with seven EEG markers, requiring sophisticated strategies for classifying multiple classes effectively.
- **Class Imbalance**: The dataset presents challenges with class imbalances. Participants will be provided with exploratory code in the 'Exploratory Data Analysis' section to visualize and understand these imbalances, crucial for developing effective models.
- **Transfer Learning Opportunity**: This competition involves transfer learning, with models trained on data from two subjects and tested on others, simulating real-world scenarios of model generalization.
- **Challenges of EEG Data Analysis**: EEG data analysis involves handling signal noise, variability, and artifacts. Participants are advised to employ preprocessing methods for data cleaning and enhancement.