A language for mental models
Project description
memo is a new probabilistic programming language for expressing computational cognitive models involving sophisticated recursive reasoning, and for performing fast enumerative inference on such models. memo inherits from the tradition of WebPPL-based Bayesian modeling (see probmods, agentmodels, and problang), but aims to make models easier to write and run by taking advantage of modern programming language techniques and hardware capabilities.
memo stands for: mental modeling, memoized matrix operations, model-expressed-model-optimized, and metacognitive memos.
[!NOTE] The version of memo in this repository is an early-stage research prototype. While we are making every effort to make memo safe and easy to use, there may be some sharp edges, and the language may occasionally change in backward-incompatible ways. Our goal is to offer a first stable release of memo in February 2025.
Installing memo
- memo is based on Python. Before installing memo, make sure you have Python 3.12 or higher installed. You can check this by running
python --version
. (As of writing, Python 3.12 is the latest version of Python, and memo depends on several of its powerful new features.) - Next, install JAX, a Python module that memo uses to produce fast, differentiable, GPU-enabled code. If you don't have a GPU, then running
pip install jax
should be enough. Otherwise, please consult the JAX website for installation instructions. You can check if JAX is installed by runningimport jax
in Python. - Finally, install memo by running
pip install memo-lang
. You can check if memo is installed by runningfrom memo import memo
in Python.
Getting started
Once you have installed memo, take a look at the Memonomicon for a tour of the language, and an example of how to build a model and fit it to data by parallel grid search and/or gradient descent.
This repository also includes several classical examples of recursive reasoning models implemented in memo:
- Scalar implicature, analogous to the example on the front page of WebPPL.org. (This example is explained in more detail in the Memonomicon.)
- Rational Speech Acts (RSA), with the recursion explicitly unrolled.
- Rational Speech Acts with recursive calls.
- A grid-world MDP with planning and inverse planning.
- A POMDP with belief-space planning.
Project details
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
Hashes for memo_lang-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 046870d1bf74cf97a0f5deaf69b2a3e4a5730d507290c61645a8c26c963d6403 |
|
MD5 | 8c888b4ce8f8c922c1d45441496a79be |
|
BLAKE2b-256 | e0629f5fd037448ff73e1c3be0a362b1cced934ec1cecbf591e5cf17b466deca |