This repository contains the official JAX implementation of the inverse optimal control method presented in the paper:
The package can be installed via pip:
python -m pip install lqgSince publication of our eLife paper, I have substantially updated the package. If you want to use the package as described in the paper, please install an older version <0.2.0:
python -m pip install lqg==0.1.9If you want the latest development version, I recommend cloning the repository and installing it locally with uv:
git clone https://github.com/RothkopfLab/lqg.git
cd lqg
uv syncThis creates a virtual environment in .venv with the package and all development dependencies (including those for tests and documentation). You can run commands in it with uv run, e.g. uv run pytest. If you want to contribute, run make install instead of uv sync, which also installs the pre-commit hooks.
The documentation contains tutorials that illustrate how to use the lqg package to define optimal control models, simulate trajectories, and infer parameters from observed data:
- Overview explains the model and its parameters, the extension to subjective internal models, and Bayesian inference of the parameters (based on my tutorial at CCN 2022).
- Data fits models to data from a tracking experiment (Bonnen et al., 2015) with maximum likelihood estimation, compares them, and checks how well they reproduce the data.
Each tutorial is a Jupyter notebook, which you can find in docs/tutorials and run locally.
If you use our method or code in your research, please cite our paper:
@article{straub2022putting,
title={Putting perception into action with inverse optimal control for continuous psychophysics},
author={Straub, Dominik and Rothkopf, Constantin A},
journal={eLife},
volume={11},
pages={e76635},
year={2022},
publisher={eLife Sciences Publications Limited}
}This implementation supports the basic LQG framework. For the extension to signal-dependent noise (Todorov, 2005), please see our NeurIPS 2021 paper and its implementation.
We have recently extended this approach to non-linear dynamics and non-quadratic costs. Please check out our NeurIPS 2023 paper and its implementation.
