Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

An implementation of game theory of mind in a agent based framework following the implementation of Devaine, et al. (2017).

Project description

tomsup 👍 Theory of Mind Simulation using Python

PyPI version Code style: flake8 pip downloads python versions

A Python Package for Agent Based simulations. The package provides a computational eco-system for investigating and comparing computational models of hypothesized Theory of mind (ToM) mechanisms and for using them as experimental stimuli. The package notably includes an easy-to-use implementation of the variational Bayesian k-ToM model developed by Devaine, et al. (2017). This model has been shown able to capture individual and group-level differences in social skills, including between clinical populations and across primate species. It has also been deemed among the best computational models of ToM in terms of interaction with others and recursive representation of mental states. We provide a series of tutorials on how to implement the k-ToM model and a score of simpler types of ToM mechanisms in game theory based simulations and experimental stimuli, including how to specify custom ToM models, and show examples of how resulting data can be analyzed.

🔧 Setup and installation

tomsup supports Python 3.6 or later. We strongly recommend that you install tomsup from pip. If you haven't installed pip you can install it from the official pip website, otherwise simply run

pip3 install tomsup 

You can also install it directly from github by simply running:

pip install git+

or more explicitly:

git clone
cd tomsup
pip3 install -e .

Getting Started with tomsup

To get started with tomsup we recommend the tutorials in the tutorials folder. We recommend that you start with the introduction.

The tutorials are provided as Jupyter Notebooks. If you do not have Jupyter Notebook installed, instructions for installing and running can be found here.

Tutorial Content file name
Introduction a general introduction to the features of tomsup which follows the implementation in the paper paper_implementation.ipynb
Creating an agent an example of how you would create new agent for the package. Creating_an_agent.ipynb
Specifying internal states a short guide on how to specify internal states on a k-ToM agent specifying_internal_states.ipynb
Pscyhopy experiment An example of how one might implement tomsup in an experiment Not a notebook, but a folder, psychopy_experiment

❓ Issues and Usage Q&A

To ask questions, report issues or request features, please use the GitHub Issue Tracker.

Using this Work


tomsup is released under the Apache License, Version 2.0.


If you use this work please cite:

  title={tomsup: An implementation of computational Theory of Mind in Python},
  author={Enevoldsen, Kenneth C and Waade, Peter Thestrup},

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tomsup, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size tomsup-1.0.3.tar.gz (25.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page