Item type:Research Data, Open Access

Code and data for "An Active Inference Model of Trust Game Behavior"

Description

This is a zipped version of the github reposiory and behavioral data for an Active Inference model of trust game behavior. It contains the software for simulation, model inversion, model comparison, classification and parameter/ prediction recovery. To use this code and reproduce any results or figures, follow the steps detailed in our readme file below. Please bear in mind that use is permitted under a CC BY-NC 4.0 license (see repo and below for details). # Code and repository for: Active Inference in Interpersonal Decision-making Simulation and modelling of trust game behavior under active inference. For license information, see LICENSE.txt ## πŸ“¦ Installation This repository is packaged as an editable installation. To reproduce the results and run the code, follow these steps: ### 1. Download and extract repository snapshot Download the ```.tar``` archive from open_UMR: https://doi.org/10.17192/openumr/407 Extract it like so: ```bash tar -xzf pymdp_depression.tar ``` ```bash cd pymdp_depression ``` Note: this repo is distributed as a snapshot, so it is not connected to the development git with its messy history. If you wish to use version control, you will need to initialise a new git repo locally. ### 2. Create environment (conda) This project uses a conda environment to ensure reproducibility. Create the exact environment I used from the provided ```.yml``` file. If you are on a windows machine, try using ```pymdp_env_incl_builds.yml```. In any case, ```pymdp_env``` will work nicely. ```bash conda env create -f pymdp_env.yml ``` Then activate the environment: ```bash conda activate pymdp_env ``` And start your ide from this environment. ### 3. Install the package Navigate to the top-level repo that contains ```pyproject.toml`` and run ```bash pip install -e . ``` ### 4. Verify your installation From your terminal, navigate to ```src/simulations``` and try running ```bash python3 simulation_loop.py ``` ## πŸ“š Repo structure The repo structure is shown below. All analyses are created within src/, and then most figures and plots are created in notebooks, using functions from model/vis.py. ``` β”œpymdp_depression/ β”œβ”€β”€ pyproject.toml # Project configuration and dependencies β”œβ”€β”€ pymdp_env.yml # conda environment β”œβ”€β”€ README.md # Project overview and instructions β”œβ”€β”€ LICENSE.txt # License information β”œβ”€β”€ .gitignore β”œβ”€β”€ data/ # preprocessed datasets β”œβ”€β”€ notebooks/ # Jupyter notebooks for analysis and plotting β”‚ └── ... # Ordered to follow figures/results in the manuscript β”‚ └── ... # Figure_SX: supplementary figures. β”œβ”€β”€ src/ β”‚ └── pymdp_depression/ β”‚ β”œβ”€β”€ model/ # Core generative model implementation β”‚ β”œβ”€β”€ simulations/ # Simulation scripts and experiment logic β”‚ β”œβ”€β”€ optimization/ # Parameter fitting and optimisation routines β”‚ β”œβ”€β”€ recovery/ # Parameter recovery analyses β”‚ β”œβ”€β”€ classification/ # Classification models and evaluation β”‚ └── model_comparison/ # Model comparison with RL, win-stay-lose-switch ``` ## πŸ„ Procedure In general, to reproduce the analyses, follow these steps: 1. Run simulations from `src/pymdp_depression/simulations/` 2. Fit models using `src/pympd_depression/optimization/data_fitting.py` and the respective configuration yaml (this was done on HPC) 3. Generate figures using `notebooks/` Further documentation and instructions can be found within the dedicated submodules, e.g. inside the recovery or model comparison modules. ## ❀️ Citation The manuscript is currently under review - the code may be updated in the process, in which case an updated repo will appear under the same doi. Publicaton will appear here: https://eckertal.github.io/personal-website/publications/

Metadata

show more
Files
Document
Type
Size
Eckert, Anna-Lena; Kirchner, Lukas; Endres, Dominik; Pawlowski, Janik; Pohlmann, SΓΆren; Zimmer, Raphaela; Herrmann, Andrea; Rief, Winfried: Code and data for "An Active Inference Model of Trust Game Behavior". . DOI: https://doi.org/10.17192/openumr/407.2.

License

Except where otherwise noted, this item's license is described as Attribution 4.0 International

Related Items

isAuthorOfDataset

Item type:Person,
Item type:Person,
Item type:Person,

isContributorOfDataset

Item type:Person,

isCuratorOfDataset

Funding Organisations

Item type:Organizational Unit,

Version History

Now showing 1 - 2 of 2
VersionDateSummary
2*
2026-07-27 18:04:25
Updated code for revised paper
2026-04-14 13:31:07
* Selected version