This script provides the code used to model and solve a model with a continuum of agents, and aggregate and idiosyncratic shocks in Appendix A.5 of Azinovic, Gaegauf, & Scheidegger (2022). For a more streamlined application, see the analytic notebook.
This script was programmed in TensorFlow 2 and is not TensorFlow 1 compatible. To install Tensorflow 2, use
$ pip install tensorflow
To upgrade from TensorFlow 1 to TensorFlow 2, use
$ pip install --upgrade tensorflow
There are two modes to run this code:
- the final network weights presented in the paper can be loaded and used to output a host of plots;
- the deep equilibrium net can be trained from scratch.
We have simplified the code such that the only user input is the desired running mode. To run, follow these instructions:
In terminal:
$ cd DeepEquilibriumNets/code/python-scripts/continuum_of_agents
$ python continuum_of_agents.py
The results are saved to ./output/deqn_continuumagents_restart
$ python continuum_of_agents.py --train_from_scratch
The results are saved to ./output/deqn_continuumagents
.