Agent-based model calibration using machine learning surrogates

https://doi.org/10.1016/j.jedc.2018.03.011Get rights and content

Abstract

Efficiently calibrating agent-based models (ABMs) to real data is an open challenge. This paper explicitly tackles parameter space exploration and calibration of ABMs by combining machine-learning and intelligent iterative sampling. The proposed approach “learns” a fast surrogate meta-model using a limited number of ABM evaluations and approximates the nonlinear relationship between ABM inputs (initial conditions and parameters) and outputs. Performance is evaluated on the Brock and Hommes (1998) asset pricing model and the “Islands” endogenous growth model Fagiolo and Dosi (2003). Results demonstrate that machine learning surrogates obtained using the proposed iterative learning procedure provide a quite accurate proxy of the true model and dramatically reduce the computation time necessary for large scale parameter space exploration and calibration.

Introduction

This work proposes a novel approach to model calibration and parameter space exploration in agent-based models (ABM). It combines supervised machine learning and intelligent sampling in the design of a surrogate meta-model, which constitutes a computationally cheap approximation of the real model.1 Our surrogate can then be employed to explore the parameter space of the model at almost zero computational costs.

ABMs deal with the study of socio-ecological systems that can be properly conceptualized through a set of micro and macro relationships. One problem with this framework is that the relevant statistical properties are a priori unknown, even to the modeler. Such properties emerge from the repeated interactions among ecologies of heterogeneous, boundedly rational and adaptive agents.2 This results in dynamic properties that cannot be studied analytically, causal mechanisms that are not always possible to identify and emergent relationships that cannot be deduced by simple aggregation of micro-level interactions (Anderson, et al., 1972, Gallegati, Kirman, 2012, Grazzini, 2012, Tesfatsion, Judd, 2006). This raises the issue of finding appropriate tools to investigate the emergent behavior of the model with respect to different parameter settings, random seeds, and initial conditions (see also Lee et al., 2015).

The primary challenge in exploring the parameter space and calibrating ABMs is the escalation in the number of parameters resulting from increasingly realistic ABM dynamics. For example, recent macroeconomic models use dozens of parameters to capture the complexity of micro-founded, multi-sector and multi-country phenomena (see Fagiolo and Roventini, 2017, for a recent survey). Existing tools for direct estimation and global sensitivity analysis (often advocated as a natural approach to ABM exploration, cf. ten Broeke, van Voorn, Ligtenberg, 2016, Moss, 2008, Thiele, Kurth, Grimm, 2014) are computationally prohibitive, requiring time and computational resources that are not often available to researchers or practitioners. This increase in the parameter set results in what is referred to as the “curse of dimensionality”, i.e. the convergence of any estimator to the true value of a smooth function defined on a high dimensional parameter space is very slow (De Marchi, 2005, Weeks, 1995). There are potentially an exponential number of local critical points in the parameter space that can be mistaken for global maxima or minima.

Traditionally, three computationally expensive steps are involved in ABM calibration; running the model, measuring calibration quality and locating parameters of interest (more on validation of ABMs in Fagiolo et al., 2017). As remarked in Grazzini et al. (2017), such steps account for more than half of the time required to estimate ABMs, even for extremely simple models. Appropriate tools need then to be designed to quickly search for “meaningful” parameters and initial conditions. One approach is to replace the computationally expensive ABM with a cheaper proxy. This is the aim of meta-models or surrogates, which approximate the relationship between ABMs’ inputs and outputs (see Fagiolo, Guerini, Lamperti, Moneta, Roventini, Sapio, 2017, Lee, Filatova, Ligmann-Zielinska, Hassani-Mahmooei, Stonedahl, Lorscheid, Voinov, Polhill, Sun, Parker, 2015) in order to quickly explore the parameter space. Surrogate models are traditionally employed as fast approximations of complex phenomena that are expensive to evaluate in real life or in simulation (see Booker et al., 1999), and are regularly leveraged to locate promising parameter combinations avoiding costly computations. Accordingly, if the approximation error is small, the surrogate can be interpreted as a reasonably good replacement for the original ABM during parameter space exploration, calibration and sensitivity analysis.3

Recently, kriging (Conti, O’Hagan, 2010, Rasmussen, Williams, 2006) has been introduced as a surrogate modeling approach to facilitate parameter space exploration and sensitivity analyses of ABMs (Bargigli, Riccetti, Russo, Gallegati, 2016, Dosi, Pereira, Roventini, Virgillito, 2016, Dosi, Pereira, Roventini, Virgillito, 2017, Dosi, Pereira, Virgillito, 2017, Salle, Yildizoglu, 2014). However, when the model’s response surface is completely unknown and possibly contains non-smooth regions, as it is typically the case in ABMs, kriging requires a large number of evaluations and extensive exploratory data analysis that increase with the size of the parameter space (more on that in Section 2). Such constraints hold also for state-of-the-art extensions (see Herlands, Wilson, Nickisch, Flaxman, Neill, Van Panhuis, Xing, Wilson, Dann, Nickisch) and it forces modelers of large scale ABM to arbitrarily fix a subset of parameters whenever the parameter space is too large (see e.g. Barde and van der Hoog, 2017).

What is needed is an efficient, “hands-off” approach to explore the complex parameter space of agent-based models that practically accounts for the limited computational resources of the user. Our approach explores the ABM parameter space using a non-parametric machine learning surrogate and iterative sampling algorithm that intelligently searches the response surface with few limiting conditions. In particular, no parametric assumptions or knowledge of the topology governing the spatial distribution of the data is required.

In a nutshell, the procedure begins by first drawing a relatively large “pool” of parameter combinations using any standard sampling routine, where each combination contains a value for each initial condition. This pool acts as a proxy for the full parameter space. Next, a (very small) random subset of combinations are drawn without replacement from the pool to initialize the learning procedure (again using any standard sampling routine). The ABM is then evaluated for each of these initial combinations and its outputs receive a “label”. Those outputs satisfying a user-defined calibration criterion are assigned to a “positive” category (label 1), otherwise to a “negative” one (label 0). A surrogate is then learned over the combinations using the selected surrogate algorithm.4 The first surrogate is used to predict the probability that unlabeled combinations in the pool belong to the “positive” category. This concludes the first round. In the second and subsequent rounds, a very small subset of the pool is drawn according to the predicted positive probability. These selections are evaluated in the ABM to learn their true labels and aggregated to the set of all other combinations that have been sampled during the previous rounds. This continues over multiple rounds until the user-defined number of evaluations (the so called “budget”) is reached or a predefined level of performance is achieved.

As illustrative examples, we apply our procedure to two well known ABMs: the asset pricing model proposed in Brock and Hommes (1998) and the endogenous growth model developed in Fagiolo and Dosi (2003). Despite their relative simplicity, the two models might exhibit multiple equilibria, allow different behavioural attitudes and account for a wide range of dynamics, which crucially depends on their parameters. We find that our machine-learning surrogate is able to efficiently filter out combinations of parameters conveying the output of interest, assess the relative importance of models’ parameters and provide an accurate approximation of the underlying ABM in a negligible amount of time. The advantages in terms of computation cost, hands-free parameter selection and ability to deal with non-linear characteristics of the ABM parameter space of our approach paves the way towards an efficient and user-friendly procedure to parameter space exploration and calibration of agent-based models.

The rest of the paper proceeds as follows. Section 2 reviews literature on ABM calibration validation, making the case for surrogate modeling. Section 3 presents our surrogate modeling methodology. Sections 4 and 5 report the results of its application to the asset pricing model proposed in Brock and Hommes (1998) and the growth model developed in Fagiolo and Dosi (2003) respectively. Finally, Section 6 concludes.

Section snippets

Calibration and validation of agent-based models: the case for surrogate modelling

As stated in Fagiolo et al. (2007) and Fagiolo, Roventini, 2012, Fagiolo, Roventini, 2017, the extreme flexibility of ABMs concerning various forms of individual behaviour, interaction patterns and institutional arrangements has allowed researchers to explore the positive and normative consequences of departing from the often over-simplifying assumptions characterizing most mainstream analytical models. Recent years have witnessed a trend in macro and financial modeling towards more detailed

Setting specification

This paper proposes an iterative algorithm to efficiently approximate a surrogate model for any ABM using a limited budget BN of ABM evaluations. Once this budget is reached, the surrogate model’s approximation of the ABM is complete and the surrogate is available to provide a nearly costless approach to predict the model’s response.10

Application I: the Brock and Hommes model

In their seminal contribution, Brock and Hommes (1998) develop an asset pricing model (referred here as B&H), where an heterogeneous population of agents trade a generic asset according to different strategies (fundamentalist, chartists, etc.). In what follow, we first briefly introduce the model (cf. Section 4.1). We then report the empirical setting (see Section 4.2) and the results of our machine learning calibration and exploration exercise (cf. Section 4.3). We recall that the seed of the

Application II: The Islands model

In the “Island” growth model (Fagiolo and Dosi, 2003), a population of heterogeneous firms locally interact discovering and diffusing new technologies, which ultimately lead to the emergence (or not) of endogenous growth. After having presented the model (Section 5.1), we describe the empirical setting (see Section 5.2) and the results of the machine learning calibration and exploration exercises (cf. Section 5.3). We recall that the seed of the pseudo-random number generator is fixed and kept

Discussion and concluding remarks

In this paper, we have proposed a novel approach to the calibration and parameter space exploration of agent-based models, which combines the use of supervised machine learning and intelligent sampling to construct a cheap surrogate meta-model. To the best of our knowledge, this is the first attempt to exploit machine learning techniques for calibration and exploration in an agent-based framework.

The results obtained with two agent-based models – the Brock and Hommes (1998) asset pricing model

Acknowledgments

We would like to thank Daniele Giachini, Mattia Guerini, Matteo Sostero, Baláz Kégl, Herbert Dawid and three anonymous referees for their comments. A special thanks goes to Antoine Mandel, who engaged in fruitful discussions and provided valuable insights and suggestions. Further, we would like to thank all the participants in seminars and workshops held at Scuola Superiore Sant’Anna (Pisa), PARIS-SACLAY Center for Data Science (CDS), CNRS, the 2016 CDS Collaborative Hackathon for Macroeconomic

References (114)

  • G. Dosi et al.

    Schumpeter meeting Keynes: A policy-friendly model of endogenous growth and business cycles

    J. Econ. Dyn. Control

    (2010)
  • G. Dosi et al.

    Causes and Consequences of Hysteresis: Aggregate Demand, Productivity and Employment

    LEM Working Papers Series 2017-07

    (2017)
  • G. Dosi et al.

    On the robustness of the fat-tailed distribution of firm growth rates: a global sensitivity analysis

    J. Econ. Inter. Coord.

    (2017)
  • A. Doucet et al.

    On sequential monte carlo sampling methods for Bayesian filtering

    Stat. Comput.

    (2000)
  • G. Fagiolo et al.

    Are output growth-rate distributions fat-tailed? Some evidence from OECD countries

    J. Appl. Econ.

    (2008)
  • J. Fernández-Villaverde et al.

    Solution and estimation methods for DSGE models

  • M. Gallegati et al.

    Reconstructing economics

    Compl. Econ.

    (2012)
  • A.B. Goldberg et al.

    Oasis: Online active semi-supervised learning

    Proceedings of the AAAI

    (2011)
  • J. Grazzini

    Analysis of the emergent properties: Stationarity and ergodicity

    J. Artif. Soc. Social Simul.

    (2012)
  • J. Grazzini et al.

    Bayesian estimation of agent-based models

    J. Econ. Dyn. Control

    (2017)
  • V. Grimm et al.

    Individual-Based Modeling and Ecology

    (2013)
  • HerlandsW. et al.

    Scalable Gaussian processes for characterizing multidimensional change surfaces

    Proceedings of Artificial Intelligence and Statistics 2016

    (2016)
  • J. Kukacka et al.

    Estimation of Financial Agent-Based Models with Simulated Maximum Likelihood

    IES Working Paper

    (2016)
  • F. Lamperti

    An information theoretic criterion for empirical validation of simulation models

    Econ. Stat

    (2017)
  • S.J. Leal et al.

    Rock around the clock: an agent-based model of low-and high-frequency trading

    J. Evol. Econ.

    (2014)
  • S. Alfarano et al.

    Estimation of agent-based models: The case of an asymmetric herding model

    Comput. Econ.

    (2005)
  • H. Amilon

    Estimation of an adaptive stock market model with heterogeneous agents

    J. Emp. Finance

    (2008)
  • P.W. Anderson

    More is different

    Science

    (1972)
  • K.J. Archer et al.

    Empirical characterization of random forest variable importance measures

    Comput. Stat. Data Anal.

    (2008)
  • T. Assenza et al.

    Emergent dynamics of a macroeconomic agent based model with capital and credit

    J. Econ. Dyn. Control

    (2015)
  • S. Barde

    Direct comparison of agent-based models of herding in financial markets

    J. Econ. Dyn. Control

    (2016)
  • S. Barde

    A practical, accurate, information criterion for nth order Markov processes

    Comput. Econ.

    (2016)
  • L. Bargigli et al.

    Network Calibration and Metamodeling of a Financial Accelerator Agent Based Model

    Working Papers, Economics

    (2016)
  • J. Bergstra et al.

    Random search for hyper-parameter optimization

    J. Mach. Learn. Res.

    (2012)
  • C. Bianchi et al.

    Validating and calibrating agent-based models: a case study

    Comput. Econ.

    (2007)
  • A. Booker et al.

    A rigorous framework for optimization of expensive functions by surrogates

    Struct. Optim.

    (1999)
  • H. Boswijk et al.

    Behavioral heterogeneity in stock prices

    J. Econ. Dyn. Control

    (2007)
  • G. Bottazzi et al.

    Explaining the distribution of firm growth rates

    RAND J. Econ.

    (2006)
  • L. Breiman

    Random forests

    Mach. Learn.

    (2001)
  • W.A. Brock et al.

    A rational route to randomness

    Econometrica

    (1997)
  • W.A. Brock et al.

    Heterogeneous beliefs and routes to chaos in a simple asset pricing model

    J. Econ. Dyn. Control

    (1998)
  • G. ten Broeke et al.

    Which sensitivity analysis method should i use for my agent-based model?

    J. Artif. Soc. Social Simul.

    (2016)
  • D.G. Brown et al.

    Path dependence and the validation of agent-based spatial models of land use

    Int. J. Geogr. Inform. Sci.

    (2005)
  • A. Caiani et al.

    Agent based-stock flow consistent macroeconomics: Towards a benchmark model

    J. Econ. Dyn. Control

    (2016)
  • C. Castaldi et al.

    The patterns of output growth of firms and countries: Scale invariances and scale specificities

    Emp. Econ.

    (2009)
  • S.-H. Chen et al.

    Agent-based economic models and econometrics

    Knowl. Eng. Rev.

    (2012)
  • T. Chen et al.

    Xgboost: A scalable tree boosting system

    Proceedings of the 22Nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining

    (2016)
  • S. Chib et al.

    Understanding the metropolis-hastings algorithm

    Am. Stat.

    (1995)
  • D.C. Cireşan et al.

    Mitosis detection in breast cancer histology images with deep neural networks

    Proceedings of the International Conference on Medical Image Computing and Computer-assisted Intervention

    (2013)
  • D. Cohn et al.

    Improving generalization with active learning

    Mach. Learn.

    (1994)
  • Cited by (179)

    • Moment set selection for the SMM using simple machine learning

      2023, Journal of Economic Behavior and Organization
    View all citing articles on Scopus
    View full text