Skip to content

sischei/DeepEquilibriumNets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deep Equilibrium Nets

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.

Authors

The paper was published at the International Economic Review, and can be found here

Illustrative examples

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.

Usage

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:

Generic badge

as well as a plain python script, which can be executed from the command line:

Generic badge 2

The benchmark model code was also written in TensorFlow 1, however, as been made TensorFlow 2 compatible.

Generic badge 3

The "continuum of agents" model code was written in TensorFlow 2.

Generic badge 4

Prerequisites / Installation

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.

TensorFlow 1

$ pip install tensorflow==1.13.1

Running Deep Equilibrium Nets in a local installation

Jupyter notebook

Launch with:

    $ cd <PATH to the repository>/DeepEquilibriumNets/code/jupyter-notebooks/analytic/
    $ jupyter-notebook Analytic_tf1.ipynb

Plain Python

Launch with:

    $ cd <PATH to the repository>/DeepEquilibriumNets/code/python-scripts/analytic/
    $ python Analytic_tf1.py

Citation

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 = {63},
number = {4},
pages = {1471-1525},
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},
abstract = {Abstract We introduce deep equilibrium nets (DEQNs)—a deep learning-based method to compute approximate functional rational expectations equilibria of economic models featuring a significant amount of heterogeneity, uncertainty, and occasionally binding constraints. DEQNs are neural networks trained in an unsupervised fashion to satisfy all equilibrium conditions along simulated paths of the economy. Since DEQNs approximate the equilibrium functions directly, simulating the economy is computationally cheap, and training data can be generated at virtually zero cost. We demonstrate that DEQNs can accurately solve economically relevant models by applying them to two challenging life-cycle models and a Bewley-style model with aggregate risk.},
year = {2022}
}

Support

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".

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages