Skip to content

Commit 517394e

Browse files
authored
Pull Request: Chen_project_2025 (#388)
* upload a page for my project * update project page with real info * add cover image and restore project metadata * add name and embed project figures
1 parent 468563f commit 517394e

File tree

5 files changed

+111
-0
lines changed

5 files changed

+111
-0
lines changed
3 MB
Loading
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
type: "project"
3+
date: "2025-06-12"
4+
title: "Brainbeats: Classifying Music Genre with fMRI Connectivity"
5+
names: [Chelsea Xuan Chen]
6+
github_repo: https://github.com/x2583319/Chen_project_2025
7+
tags: [fmri, music, connectivity, classification]
8+
summary: "Can we predict music genres based on fMRI connectivity patterns alone? This project explores a single-subject decoding approach using ROI-to-ROI correlation matrices and machine learning classifiers on OpenNeuro dataset ds003720."
9+
image: "cover.png"
10+
---
11+
12+
## Project definition
13+
14+
### Background
15+
16+
Music evokes rich and complex responses in the brain—and I wanted to explore whether functional connectivity patterns alone could reflect the genre of music being heard. Inspired by Nakai et al. (2021), who used voxelwise patterns across five participants to decode music genre, I chose to narrow the focus to a single-subject analysis.
17+
18+
Due to event file inconsistencies in sub-001 to sub-004, only sub-005 contained intact and correctly labeled annotations across all six runs. My project thus became a pilot proof-of-concept: could trial-wise ROI-to-ROI correlation matrices, extracted via the Schaefer 100-ROI atlas, support genre decoding even within just one brain?
19+
20+
### Tools
21+
22+
This project used:
23+
24+
- Python & Jupyter Notebooks
25+
- `nilearn` for ROI time series extraction and brain visualization
26+
- `scikit-learn` for PCA and classification (SVM, KNN)
27+
- `matplotlib` & `seaborn` for plotting and visual diagnostics
28+
29+
### Data
30+
31+
- Dataset: [OpenNeuro ds003720](https://openneuro.org/datasets/ds003720)
32+
Nakai, T., Koide‑Majima, N., & Nishimoto, S. (2021). *Brain and Behavior*, 11(1), e01936.
33+
34+
- Used only `sub-005` due to complete event labels (manual inspection revealed misalignments in other subjects)
35+
36+
- 6 runs, each with ~40 musical trials; each trial is a 10-second clip; 10 total genres in the dataset
37+
38+
- Brain parcellation: Schaefer 100-ROI cortical atlas (98 usable ROIs after resampling)
39+
40+
- Final dataset: 98 usable trials, filtered to exclude clips <2 TRs or with correlation errors
41+
42+
> Why only sub-005? The other subjects had corrupted or mismatched event files that broke alignment between music clips and fMRI data.
43+
44+
### Deliverables
45+
46+
- Trial-wise ROI-to-ROI correlation matrices
47+
- Atlas and correlation matrix visualizations
48+
- PCA dimensionality reduction pipeline
49+
- Genre classification with SVM and KNN
50+
- Final presentation slide deck (≤15 minutes)
51+
52+
---
53+
54+
## Results
55+
56+
### Progress overview
57+
58+
- Extracted time-series from 98 ROIs using `NiftiLabelsMasker` in `nilearn`
59+
- Computed ROI-to-ROI Pearson correlations → 100×100 matrix → flattened to 4950D feature vector
60+
- Applied PCA (n=20) for dimensionality reduction
61+
- Trained classifiers (SVM, KNN) for multiclass and binary decoding
62+
63+
### Tools I learned during this project
64+
65+
- `nilearn` atlas-based ROI extraction
66+
- Correlation matrix construction + vectorization
67+
- PCA feature compression
68+
- Classification using `SVC`, `KNeighborsClassifier`, and cross-validation
69+
- Confusion matrix and performance visualization
70+
71+
### Deliverable 1: Multiclass genre classification
72+
73+
- SVM + PCA yielded ~13% accuracy (above 10% random baseline for 10 genres)
74+
- Confusion matrix showed some genre-specific signal, particularly for Reggae (not shown in final binary model)
75+
76+
### Deliverable 2: Binary genre decoding (Pop vs. Metal)
77+
78+
- SVM + PCA achieved ~68% accuracy (above chance), though **KNN was too unstable to evaluate**
79+
- Performance varied across runs, likely due to short duration and low trial count
80+
81+
### Deliverable 3: Visualizations
82+
83+
- Schaefer 100-ROI brain parcellation plotted to validate resampling and mask quality
84+
- Average correlation matrix showed strong within-region signals (clean diagonals)
85+
86+
#### Schaefer Atlas
87+
![Schaefer Atlas](schaefer.png)
88+
89+
#### ROI Correlation Matrix
90+
![ROI Correlation](roi_correlation.png)
91+
92+
#### PCA Confmax
93+
![PCA Confmax](pca_confmax.png)
94+
95+
---
96+
97+
## Reflection
98+
99+
This pilot study suggests that even within a single brain, genre-relevant information can be gleaned from ROI connectivity patterns. But limitations remain:
100+
101+
- Generalizability limited by sample size (n=1)
102+
- Low trial count vs. high feature dimension = overfitting risk
103+
- Classifier performance unstable across reruns
104+
105+
## Future directions
106+
107+
- Use more participants (once metadata is cleaned!)
108+
- Try higher-resolution atlases (e.g., Schaefer 200-ROI)
109+
- Experiment with sliding window connectivity or graph-based features
110+
- Combine with music theory-based audio features (e.g., tempo, tonality) for hybrid modeling
111+
- Explore feature importance: which ROI-pairs drive classification?
231 KB
Loading
69.3 KB
Loading
44.2 KB
Loading

0 commit comments

Comments
 (0)