Skip to content

GnohzZ/Brain-Dynamics-Modeling-Acceleration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code for Modeling Macroscopic Brain Dynamics with Brain-inspired Computing Architecture

This code implements the low-precision macroscopic brain dynamics. We present the curves (2-D distribution) of the commonly used indicators.

files and folders:

- exps/
    - data/: group-average empirical data
    - exp_results/: the location of the generated data and plots
    - *.mlx
    - *.m
- lib/: codes for the implementation of the brain models and indicator evaluation.
- hopf_model/
- powerspectra/
- sample_entropy/

datasets:

We put the group-average 68-node empirical data in data/data_68_avg/000000_FCSC_Desikan68_ave_2_G_MOEM.mat

We put the group-average 148-node empirical data in data/data_148_avg/000000_data_HCP_148_ave.mat

We put the 1004-participant empirical data in data/data_HCP1004_68. It is obtained from CBIG/stable_projects/fMRI_dynamics/Zhang2024_pFIC/replication/HCP/input at master · ThomasYeoLab/CBIG · GitHub

Pre-requisites

MATLAB 2024b with necessary ads-ons such as Image Processing Toolbox, Signal Processing Toolbox and so on. If any required toolbox is missing during code execution, MATLAB should display an error indicating which specific add-on needs to be installed.

code running

2D plot

Open the exps folder in MATLAB and run acc_plot_2d.mlx.

The generated plots will be in exps/exp_results/acc_curve_2d

change the model precision

Change the string in line 15 in acc_plot_2d.mlx

  • "float": to run high-precision model
  • "18_36_72": to run the quantization simulation of low-precision model without group-wise quantization
  • "18_36_72_grp": to run the quantization simulation of low-precision model with group-wise quantization

change the random seed

Change the number in line 38 in acc_plot_2d.mlx

change the parameter $w$ and $I_0$

Change the floating-point numbers in line 63 and line 64 in acc_plot_2d.mlx

3D indicator distribution correlation

Open the exps folder in MATLAB and run systematic_comparison.m.

change the model scale

Change the path in line 10

  • "data/data_68_avg": to run with 68-node data
  • "data/data_148_avg": to run with 148-node data

Note: To save time, we comment the code for evaluate the indicators of each point (for-loop from line 59s) and only analyze the results from our experiment. You can run the complete code manually

Model inversion results

Open the exps folder in MATLAB and run val_and_test_new_data_quant.m and val_and_test_new_data.m

change the algorithm-precision config

Change the model in line 71 of val_and_test_new_data_quant.m

  • "pso_quant_68": to test the pso+low-precision result
  • "cmaes_quant_68": to test the cma-es+low-precision result

Change the model in line 71 of val_and_test_new_data.m

  • "pso_float_68": to test the pso+high-precision result
  • "cmaes_float_68": to test the cma-es+high-precision result

Note: To save time, we comment the code for validation (around line 220) and only run the test results with validated data. You can run the complete code manually

Run model inversion

pso_quant.m and cmaes_quant_test.m are two example code for model inversion.

The inferred parameters will be stored in /exps/exp_results/pso_low_precis/000000, and you can run get_best_points.m to test all the results.

Note: The quality of the model inversion result may fluctuate each time we run the algorithm. So we recommend running the code for several times and choose a best solution from the results.

Hopf results

Open the hopf_model folder in MATLAB and run run_simulations_plane.m (this may cost a lot of time)

Powerspectra results

Open the powerspectra\simulation\scripts_group_0_f folder in MATLAB and run compute_simulation_group_0_f.m

Open the powerspectra\simulation\scripts_group_0_i folder in MATLAB and run compute_simulation_group_0_i.m

Sample Entropy

Open the sample_entropy folder in MATLAB and run correlation_experience_0_f.m and correlation_expserience_0_i.m

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages