Frequency-domain model explanation (IG) package
Project description
FLEX: Frequency Layer Explanation
Overview
This repository contains the implementation of FLEX (Frequency Layer Explanation), a method designed to explain the predictions of deep neural networks (DNNs) for sleep stage classification using EEG data. FLEX combines Integrated Gradients (IG) with a frequency-domain transform (via the Real Fast Fourier Transform (RFFT)) to provide frequency-based attribution scores.
The method is particularly useful for understanding how different frequency components of EEG signals influence the predictions of a DNN, enhancing model interpretability in the context of sleep research.
We will always talk about EEG Data in Sleep Research here, but in general this method can be used for a frequency-wise understanding of a model classifying time-series data.
Features
- RFFT Transformation: Input EEG signals are transformed into the frequency domain using the RFFT.
- iRFFT Transformation: The inverse RFFT (iRFFT) is implemented as the first layer in the DNN to process frequency-domain inputs.
- Integrated Gradients Attribution: Captum's IG method is used to compute relevance scores for frequency bands, providing insights into the features contributing to the model's predictions.
Definition of FLEX
Let F be our model (DNN) and x be our input (EEG-Data). Then with $\bar{F} = F \circ iRFFT$ and $\bar{x} = RFFT(x)$ we get $$FLEX_i(F,x) = IG_i(\bar{F},\bar{x})$$, where $FLEX(F,x) = (FLEX_1(F,x), ..., FLEX_n(F,x))$ with $x \in R^n$.
Installation
Requirements
- Python 3.8+
- Required libraries:
numpytorchcaptum
Install Dependencies
You can install the required Python libraries using pip:
pip install numpy torch captum
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file freqig-0.1.0.tar.gz.
File metadata
- Download URL: freqig-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
046ce31acb861fc15b6e110a33cea06cf016656af2f73f895eaf56dd42798622
|
|
| MD5 |
2652c8e5692d2e2b575aaa790c34525f
|
|
| BLAKE2b-256 |
78149443d99d219ac5e4027492fc0955450de11d6c4e3e2136882a18b142122e
|
File details
Details for the file freqig-0.1.0-py3-none-any.whl.
File metadata
- Download URL: freqig-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a550a76b771c13a127438429f078d8a09cd19db9216c99263a5188d50d7a93a9
|
|
| MD5 |
ed82a79cb1a6ab333a18d72520bd4ba2
|
|
| BLAKE2b-256 |
8fce592c6086f4a01715720e45dc3e1af7fe468e1326018059b98c012b67abb2
|