Skip to content

MIntelligence-Group/MRP

Repository files navigation

Machine Learning-Based Classification of Jhana Advanced Concentrative Absorption Meditation (ACAM-J) using 7T fMRI
===================================================================================================

Implementation for the preprint.   
**[Machine Learning-Based Classification of Jhana Advanced Concentrative Absorption Meditation (ACAM-J) using 7T fMRI][1]**  
[Puneet Kumar](#), [Winson F. Z. Yang](#), [Alakhsimar Singh](#), [Xiaobai Li](#), and [Matthew D. Sacchet](#)

This repository contains the analysis pipeline used for ReHo-based classification of ACAM-J, residual analysis, and brain-plot generation.

## Code Files

### 1. `1_Step1_SMOTE_Up-sampling.ipynb`

**Input**
- `../Data/1ReHo/reho_output.csv`

**Output**
- `../Data/1ReHo/reho_output_upsampled.csv`

This notebook performs SMOTE-based up-sampling and saves the upsampled ReHo data for downstream analysis.

---

### 2. `2_Step2_Binary_Classification.ipynb`

**Backup:** `2_Step2_Binary_...ipynb`  
**Recommended version:** run **v4.3 Modularized**

**Input**
- `../Data/important ROI ranking v3_hypothesized-rois.csv`

**Outputs**
- `output_{timestamp}.txt`  
  Duplicates everything printed to the console.

- `scores_{timestamp}/`
  - `feature_importance_{ModelName}_{label1}_vs_{label2}.csv`  
    One CSV per top model for each pair.  
    **Move to `Results/` and rename as required.**
  - `average_feature_importance_{label1}_vs_{label2}.csv`  
    One CSV per pair with averaged (normalized) feature importances (FSA files).  
    **Move to `Plotting_Archive/stat/` folder.**

This notebook runs the binary classification experiments and generates feature-importance outputs for downstream analysis and plotting.

---

### 3. `3_Results_Plots.ipynb`

**Inputs**
- `results_after_RA.txt`
- `results_before_RA.txt`

**How to use**
- Call `analyze_performance()` with the above two input files.

**Output**
- `Plot_results_after_RA_VS_results_before_RA.png`

This notebook compares performance before and after residual analysis.

---

### 4. `Plotting_Archive/src/4_ReHoDiffFilesGen.ipynb`

**Inputs**
- `"X vs Y.csv"` files from `../stat/1FSA`
- `reho_data_path = "../../../Data/1ReHo/reho_output_upsampled.csv"`
- `roi_rankings_path = "../Data/important_ROI_ranking_v3_hypothesized-rois.csv"`

**Outputs**
- `"ReHo(Y)-ReHo(X).csv"` files in `../stat/2ReHoDiff`  
  Files containing only the ROIs present in the corresponding `"X vs Y.csv"` files.
- Intermediate output (not saved):  
  `"ReHo(Y)-ReHo(X)_all.csv"`  
  Files containing all ROIs.

This notebook generates ReHo-difference files for plotting and interpretation.

---

### 5. `Plotting_Archive/src/5_plot_brain_PK.ipynb`

Place all **FSA** and **ReHo Diff** `.csv` files in:

- `Plotting_Archive/stat`

#### To draw cortex plots
- Run the **2nd cell**
- Output will be saved in:
  - `Plotting_Archive/fig`

> Note: This also draws sub-cortex plots, but those should not be used.

#### To draw sub-cortex plots
- Run the **3rd cell**
- Enter the corresponding subcortex/Tian map
- Find x-coordinates for left and right hemisphere and set:
  - `cut_coors = [x1, x2]`
- Run the next cell and call:
  - `plot_subcortex`

The plot will be displayed and saved.

---

## Residual Analysis

To run the same pipeline for residual analysis:

- Use `reho_residuals.csv` instead of `reho_output.csv`
- Save the results as:
  - `results_after_RA.txt`

This file is then used in:
- `3_Results_Plots.ipynb`

---

## Suggested Run Order

1. `1_Step1_SMOTE_Up-sampling.ipynb`
2. `2_Step2_Binary_Classification.ipynb`
3. `3_Results_Plots.ipynb`
4. `Plotting_Archive/src/4_ReHoDiffFilesGen.ipynb`
5. `Plotting_Archive/src/5_plot_brain_PK.ipynb`

For residual analysis, rerun the pipeline using `reho_residuals.csv` and compare outputs with the standard run.

---

## Notes

- Several notebooks assume specific relative paths. Update them if your local folder structure differs.
- Some output files are generated automatically but need to be moved manually to the appropriate folders for downstream plotting.
- This README documents notebook usage and file flow. Dependency and environment details can be added separately if needed.

## Citation

If you use this repository, please cite:

**Machine Learning-Based Classification of Jhana Advanced Concentrative Absorption Meditation (ACAM-J) using 7T fMRI**

## Links

[1]: https://arxiv.org/abs/2602.13008

About

Meditation Research Program

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors