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
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.
📰 News
- V. 1.1.3
- New plotting features were added
- Speed and memory improvements as well as support for multicore simulations 🏎
- Added workflows to ensure dependencies are being kept up to date
- v. 1.1.0
- A speed comparison between the matlab implementation was introduced, showing the the tomsup implementation to be notably faster.
- An extensive testsuite was introduced, for how to run it see the FAQ.
- Code coverage was upped to 86% and code quality was raised to A.
- A documentation site was introduced.
- Added continiuous integration to ensure that the package always works as intended, with support for mac, windows and linux tests.
- A new logo was introduced 🌟
- v. 1.0.0
🔧 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, run:
pip install tomsup
Detailed instructions
You can also install it directly from GitHub by simply running:
pip install git+https://github.com/KennethEnevoldsen/tomsup.git
or more explicitly:
git clone https://github.com/KennethEnevoldsen/tomsup.git
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 | Open with |
---|---|---|---|
Documentation | The documentations of tomsup | ||
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 | |
Psychopy 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 report issues or request features, please use the GitHub Issue Tracker. Otherwise, please use the discussion Forums.
FAQ
How do I test the code and run the test suite?
tomsup comes with an extensive test suite. In order to run the tests, you'll usually want to clone the repository and build tomsup from the source. This will also install the required development dependencies and test utilities defined in the requirements.txt.
pip install -r requirements.txt
pip install pytest
python -m pytest
which will run all the test in the tomsup/tests
folder.
Specific tests can be run using:
python -m pytest tomsup/tests/<DesiredTest>.py
Code Coverage If you want to check code coverage you can run the following:
pip install pytest-cov
python -m pytest--cov=.
Does tomsup run on X?
tomssup is intended to run on all major OS, this includes Windows (latest version), MacOS (Catalina) and the latest version of Linux (Ubuntu). Please note these are only the systems tomsup is being actively tested on, if you run on a similar system (e.g. an earlier version of Linux) the package will likely run there as well.
How is the documentation generated?
Tomsup uses sphinx to generate documentation. It uses the Furo theme with a custom styling.
To make the documentation you can run:
# install sphinx, themes and extensions
pip install sphinx furo sphinx-copybutton sphinxext-opengraph
# generate html from documentations
make -C docs html
Using this Work
License
tomsup is released under the Apache License, Version 2.0.
Citing
If you use this work please cite:
@article{enevoldsen2020tomsup,
title={tomsup: An implementation of computational Theory of Mind in Python},
author={Enevoldsen, Kenneth C and Waade, Peter Thestrup},
year={2020},
publisher={PsyArXiv}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tomsup-1.1.4.tar.gz
.
File metadata
- Download URL: tomsup-1.1.4.tar.gz
- Upload date:
- Size: 40.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9b473716c6822d79b7dd3b657c624deeb73ca9b042d279fe57b692b4cf0bba3 |
|
MD5 | 1b2d69e8551dd31bafdf046667289d67 |
|
BLAKE2b-256 | 10bc0fdd2c68ddd7add028e34df5e1d853e57b2dd66a83482ab89fff812e8088 |
File details
Details for the file tomsup-1.1.4-py3-none-any.whl
.
File metadata
- Download URL: tomsup-1.1.4-py3-none-any.whl
- Upload date:
- Size: 41.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ff067ae7f844874bf247ba94f8f23243529ba0414b0c19216cf13cb0f946a96 |
|
MD5 | 47508bf5294505aeb11ee5feebec28e0 |
|
BLAKE2b-256 | 03237f2665108563b97d6fbe4040c488d1674911ed0d00ecf74d03d00a0851e3 |