Deep equilibrium nets (DEQN) is a generic, deep-learning-based framework to compute recursive equilibria in dynamic stochastic economic models. The method directly approximates all equilibrium functions and that are trained in an unsupervised fashion to satisfy all equilibrium conditions along simulated paths of the economy.
This repository contains example codes in TensorFlow. Its goal is to make DEQNs easily accessible to the computational economics and finance community.
- Marlon Azinovic (University of Zurich, Department of Economics)
- Luca Gaegauf (University of Zurich, Department of Banking and Finance)
- Simon Scheidegger (University of Lausanne, Department of Economics)
Analytic model: To illustrate how DEQNs can be applied to solve economic models, we provide an example in python, which solves the model presented in Appendix A.8 of the paper. The presented model is taken from Krueger and Kubler (2004) and is based on Huffman (1987). We chose this model as an illustrative example for two reasons: first, it is closely related to the models we solve in the paper and second, it has an analytical solution, so the accuracy of the solution method can easily be verified.
Benchmark model: We provide the code used to solve our benchmark model (section 3) with the trained neural network weights.
"continuum of agents" model: We provide the code used to solve our "continuum of agents" model (Appendix A.5) with the trained neural network weights.
We provide implementations which use python 3.
First, we provide our an implementation of the analytic model in two forms. A jupyter-notebook that is self-contained and also contains the model and all relevant equations:
as well as a plain python script, which can be executed from the command line:
The benchmark model code was also written in TensorFlow 1, however, as been made TensorFlow 2 compatible.
The "continuum of agents" model code was written in TensorFlow 2.
To run the code for the implementation with an analytical solution, follow the instructions below. For instructions on how to run the benchmark or "continuum of agents" model, see the corresponding: benchmark README or "continuum of agents" README.
$ pip install tensorflow==1.13.1
Launch with:
$ cd <PATH to the repository>/DeepEquilibriumNets/code/jupyter-notebooks/analytic/
$ jupyter-notebook Analytic_tf1.ipynb
Launch with:
$ cd <PATH to the repository>/DeepEquilibriumNets/code/python-scripts/analytic/
$ python Analytic_tf1.py
Please cite Deep Equilibrium Nets in your publications if it helps your research:
@article{https://doi.org/10.1111/iere.12575,
author = {Azinovic, Marlon and Gaegauf, Luca and Scheidegger, Simon},
title = {DEEP EQUILIBRIUM NETS},
journal = {International Economic Review},
volume = {n/a},
number = {n/a},
pages = {},
year={2022}
doi = {https://doi.org/10.1111/iere.12575},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1111/iere.12575},
eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1111/iere.12575}
}
This work was generously supported by grants from the Swiss National Supercomputing Centre (CSCS) under project IDs s885, s995, the Swiss Platform for Advanced Scientific Computing (PASC) under project ID "Computing equilibria in heterogeneous agent macro models on contemporary HPC platforms", the Swiss National Science Foundation (SNF), under project IDs "Can Economic Policy Mitigate Climate-Change?", and "New methods for asset pricing with frictions".