Skip to content

payampiray/cbm_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CBM (Computational Brain/Behavior Modeling)

Python License

"Computational Brain/Behavior Modeling (CBM)" Library for model fitting and model selection.

Overview

CBM provides a complete pipeline for fitting computational models to behavioral data and comparing competing models at the group level. The toolkit implements three core methods:

  1. Individual-level fitting uses Laplace approximation to estimate maximum a posteriori (MAP) parameters for each subject, providing both parameter estimates and model evidence.

  2. Bayesian Model Selection (BMS) implements random effects analysis to determine the frequency of different models in the population, accounting for between-subject variability.

  3. Hierarchical Bayesian Inference (HBI) performs joint fitting and model comparison, pooling information across subjects and models to improve parameter estimation while simultaneously inferring model frequencies.

The library is designed for cognitive modeling applications where multiple computational models are fit to data from multiple subjects, and researchers need to determine which model best explains the data at the group level.

Features

  • Individual Fitting: Maximum a posteriori (MAP) estimation with Laplace approximation
  • Bayesian Model Selection: Random effects model selection with exceedance probabilities
  • Hierarchical Bayesian Inference: Group-level inference across subjects and models

Installation

git clone https://github.com/payampiray/cbm_python.git
cd cbm_python
pip install -e .

Examples

  • examples/exampla_individual_fit.py: Minimal individual fit
  • examples/example_model_selection.py: BMS with linear models
  • examples/example.py: HBI with linear models
  • examples/example_RL.py: Individual fit and HBI with RL vs RL2 (dual learning rates)

Outputs are written to examples/output/.

Development

  • Python >= 3.9
  • Dependencies: NumPy, SciPy, Pickle
  • Logs and pickle outputs are stored under examples/output/

Related packages

References

If you use this package, please cite the following paper:

  • Piray et al., "Hierarchical Bayesian inference for concurrent model fitting and comparison for group studies", PLoS Computational Biology, 2019.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages