JayLacoma commited on
Commit
cada990
·
verified ·
1 Parent(s): 67732c0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +52 -1
README.md CHANGED
@@ -6,7 +6,58 @@ base_model:
6
  - google-bert/bert-base-uncased
7
  ---
8
 
9
- How to use the model step-by-step:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  ---
12
 
 
6
  - google-bert/bert-base-uncased
7
  ---
8
 
9
+ # Transformer-Based fMRI Encoder Model
10
+
11
+ This repository contains a Transformer-based model trained on neuroimaging datasets to classify conditions like Autism Spectrum Disorder (ASD) and ADHD, and to analyze brain activity during movie-watching. The model combines fMRI data with demographic features (age and gender) for binary classification tasks. Below is a detailed explanation of the datasets, model architecture, and training process.
12
+
13
+
14
+ ## **Model Architecture**
15
+
16
+ The model integrates multi-modal data and leverages a Transformer backbone for feature extraction. Below is a breakdown of its components:
17
+
18
+ ### **1. Inputs**
19
+ - **fMRI ROI Data:** High-dimensional features representing brain activity.
20
+ - **Age Data:** Numerical input passed through a Multi-Layer Perceptron (MLP).
21
+ - **Gender Data:** Binary input (male/female) embedded into a dense representation.
22
+
23
+ ### **2. Transformer Backbone**
24
+ - A pretrained Hugging Face Transformer (e.g., BERT) with:
25
+ - Configurable number of attention heads, layers, and hidden size.
26
+ - Dropout for regularization.
27
+ - Dynamically adjusted hyperparameters using `AutoConfig`.
28
+
29
+ ### **3. Pooling Mechanisms**
30
+ - Aggregates the Transformer’s sequence outputs into a single vector using:
31
+ - **Mean Pooling:** Averages hidden states.
32
+ - **Max Pooling:** Selects the maximum value for each feature.
33
+ - **Attention Pooling:** Learns attention weights to emphasize important sequence elements.
34
+
35
+ ### **4. Output**
36
+ - A fully connected layer maps the pooled output to a scalar value for binary classification.
37
+
38
+ ---
39
+
40
+ ## **Training Process**
41
+
42
+ ### **Key Details:**
43
+ - **Loss Function:** Binary Cross Entropy with Logits (`BCEWithLogitsLoss`), with class imbalance handled using positive weights.
44
+ - **Optimizer:** Ranger (combines RAdam and Lookahead for stable convergence).
45
+ - **Learning Rate Scheduler:** Cosine Annealing for gradual learning rate reduction.
46
+ - **Gradient Clipping:** Prevents exploding gradients with a clipping threshold of 1.0.
47
+ - **Early Stopping:** Stops training after 250 epochs without validation loss improvement.
48
+
49
+ ### **Datasets Used:**
50
+ 1. **ABIDE:** Autism vs. control classification.
51
+ 2. **ADHD-200:** ADHD vs. control classification.
52
+ 3. **Pixar Movie Dataset (Nilearn):** Brain activity analysis during movie-watching.
53
+
54
+ ### **Output:**
55
+ The model’s state dictionary is saved as `fmri_encoder_model.pth`.
56
+
57
+ ---
58
+
59
+ ## **How to Use This Model**
60
+
61
 
62
  ---
63