SLIDE 1 Calibrating Agent-Based Models with Machine Learning Surrogates
Francesco LAMPERTI 1,2, Antoine MANDEL 2, Andrea ROVENTINI 1, Amir SANI 2
1Institute of Economics and LEM, Scuola Superiore Sant’Anna (Pisa) 2Universit´
e Paris 1 Path´ eon-Sorbonne, Centre d’Economie de la Sorbonne and CNRS, Paris School of Economics
Macroeconomic Agent-Based Modeling Surrogates Workshop
February 9th, 2016
Research supported by Horizons 2020 FET, DOLFINS project.
SLIDE 2
What is the Problem? What is our Approach? Example Evaluation Times Empirical Results Empirical Results
SLIDE 3
What is the Problem?
SLIDE 4 (many) Macroeconomic Agent-Based Models (ABMs) are
◮ computationally expensive ◮ defined by dozens of parameters ◮ hard to calibrate, estimate, test, explore ∗
∗Due to complex parameter-specific behaviours.
SLIDE 5
What are we proposing?
SLIDE 6
Machine Learning Surrogates!
SLIDE 7 Faster
◮ Agent-Based Model “Calibration” (e.g. Inference) ◮ Scenario Stress Testing (e.g. Monte Carlo) ◮ Policy Exercises (e.g. Exploration)
SLIDE 8 Faster
◮ Agent-Based Model “Calibration” (e.g. Inference) ◮ Scenario Stress Testing (e.g. Monte Carlo) ◮ Policy Exercises (e.g. Exploration)
SLIDE 9 Faster
◮ Agent-Based Model “Calibration” (e.g. Inference) ◮ Scenario Stress Testing (e.g. Monte Carlo) ◮ Policy Exercises (e.g. Exploration)
SLIDE 10
Surrogate(ABM + “Calibration” Qality Test)
SLIDE 11 Surrogate
- Brock & Hommes ABM + Kolmogorov–Smirnov
Two Sample Test
SLIDE 12
Brock & Hommes (BH) Very simple ABM with 10 parameters
SLIDE 13
Brock & Hommes This model is NOT representative of complex Macroeconomic Agent-Based Models
SLIDE 14
Brock & Hommes Smooth Learning Manifold
SLIDE 15
but
SLIDE 16
13.4 quadrillion combinations
SLIDE 17
Tiny positive region
SLIDE 18
Enormous parameter space!
SLIDE 19
SLIDE 20
The Curse of Dimensionality!
SLIDE 21
How do we measure calibration quality?
SLIDE 22
Kolmogorov–Smirnov Two Sample Test (KS)
SLIDE 23 Dn,n′ = sup
x
- FXSP500,n(x) − FXBH,n′(x)
SLIDE 24
SLIDE 25
Evaluation Times
SLIDE 26
Single Evaluation BH + KS = 0.30seconds
SLIDE 27
Policy Constraint
Security prices are not negative
SLIDE 28
Policy Constraint
Only run parameters yi that pass the following constraint (filter), S(T1 ∗ P + B1) + (1 − S) ∗ (T2 ∗ P + B2) > 0, where S is the share type, P is the initial deviation from the fundamental price, B1 and B2 are the bias of agent 1 and 2, and T1 and T2 are the trend of agent 1 and 2.
SLIDE 29
Simulation X BH(yi) = X BH
SLIDE 30
Simulation Objective yi that produce 250 Log Returns
SLIDE 31
An obvious Constraint
SLIDE 32
Length Filter ABM simulations should produce 250 Log Returns
SLIDE 33
Length Filter len(X BH) == 250
SLIDE 34 Length Filter (Density) 3,000 per 100,000†
†Random Latin Hypercube Sampling[4]
SLIDE 35
2-Sample KS Test KS(X SP500, X BH) = {DX SP500,X BH, p-value}
SLIDE 36
KS Threshold p-value >0.05 DXSP500,XBH <0.20
SLIDE 37 KS Threshold (Density) 55 per 1,000,000‡
‡Random Latin Hypercube Sampling[4]
SLIDE 38
Dataset Highly Imbalanced!
SLIDE 39
Evaluation Time
SLIDE 40
Evaluation Time 1,000,000 samples ≈ 3.5 days
SLIDE 41
Evaluation Time 100 passing tests ≈ 20.4 days
SLIDE 42
What about a Machine Learning Surrogate?
SLIDE 43 Surrogate Modeling
◮ Function Approximation [3] ◮ Meta-Modeling [1] ◮ “Response Surface” Methodology [2, 5] ◮ Experimental Design ◮ Model Emulation ◮ “Model of a Model”
SLIDE 44 Surrogate Solution
- Draw 1, 000, 000 parameters using RLH
- Policy Constraint ≈ 500, 000
- Time to compute yPC
i
≈ 0.25 secs
i
) = X PC
i
: 2, 500 min
- Length Constraint ≈ 3, 000 yPC,len
i
: 5 min
i
) = {DXSP500,XPC,len
i
, p-valuePC,len
i
}: 800 min
- Threshold Constraint ≈ 55 yPC,len,Thresholded
i
: 1 min
SLIDE 45 Surrogate Solution
- Draw 1, 000, 000 parameters using RLH
- Policy Constraint ≈ 500, 000
- Time to compute yPC
i
≈ 0.25 secs
i
) = X PC
i
: 2, 500 min
- Length Constraint ≈ 3, 000 yPC,len
i
: 5 min
i
) = {DXSP500,XPC,len
i
, p-valuePC,len
i
}: 800 min
- Threshold Constraint ≈ 55 yPC,len,Thresholded
i
: 1 min
SLIDE 46 Surrogate Solution
- Draw 1, 000, 000 parameters using RLH
- Policy Constraint ≈ 500, 000
- Time to compute yPC
i
≈ 0.25 secs
i
) = X PC
i
: 2, 500 min
- Length Constraint ≈ 3, 000 yPC,len
i
: 5 min
i
) = {DXSP500,XPC,len
i
, p-valuePC,len
i
}: 800 min
- Threshold Constraint ≈ 55 yPC,len,Thresholded
i
: 1 min
SLIDE 47 Surrogate Solution
- Draw 1, 000, 000 parameters using RLH
- Policy Constraint ≈ 500, 000
- Time to compute yPC
i
≈ 0.25 secs
i
) = X PC
i
: 2, 500 min
- Length Constraint ≈ 3, 000 yPC,len
i
: 5 min
i
) = {DXSP500,XPC,len
i
, p-valuePC,len
i
}: 800 min
- Threshold Constraint ≈ 55 yPC,len,Thresholded
i
: 1 min
SLIDE 48 Surrogate Solution
- Draw 1, 000, 000 parameters using RLH
- Policy Constraint ≈ 500, 000
- Time to compute yPC
i
≈ 0.25 secs
i
) = X PC
i
: 2, 500 min
- Length Constraint ≈ 3, 000 yPC,len
i
: 5 min
i
) = {DXSP500,XPC,len
i
, p-valuePC,len
i
}: 4, 000 min
- Threshold Constraint ≈ 55 yPC,len,Thresholded
i
: 1 min
SLIDE 49
Total Time BH+KS: 6, 5081
4min
SLIDE 50 Out of Sample 100, 000, 000 out of sample yi§ ≈ 2 min
§using RLH
SLIDE 51
BH+KS 1, 000 × 6, 5081
4min = 6, 508, 250 min
SLIDE 52 Machine Learning Surrogate
- (naive) Budgeted Model Search¶: 60 min
¶htps://github.com/hyperopt/hyperopt-sklearn
SLIDE 53
Machine Learning Surrogate Filter OOS using Learned Model ≈ 12 min
SLIDE 54
Speedup (OOS Only) BH+KS: 1, 000 × 6, 5081
4min = 6, 508, 250 min
Machine Learning Surrogate: 72 min ≈ 90, 3921
3× Speedup!
SLIDE 55
Advantage Reusable Machine Learning Surrogate Model
SLIDE 56
SLIDE 57
SLIDE 58
Thank you!
SLIDE 59 References
[1] Robert W Blanning. The construction and implementation of metamodels. simulation, 24(6):177–184, 1975. [2] George EP Box and KB Wilson. On the experimental atainment of optimum
- conditions. Journal of the Royal Statistical Society. Series B (Methodological),
13(1):1–45, 1951. [3] Donald R Jones. A taxonomy of global optimization methods based on response surfaces. Journal of global optimization, 21(4):345–383, 2001. [4] Michael D McKay, Richard J Beckman, and William J Conover. Comparison of three methods for selecting values of input variables in the analysis of output from a computer code. Technometrics, 21(2):239–245, 1979. [5] Raymond H Myers, Douglas C Montgomery, and Christine M Anderson-Cook. Response surface methodology: process and product optimization using designed experiments, volume 705. John Wiley & Sons, 2009. [6] The Art of Sofware. Derivation of Bias-Variance Decomposition, September
- 2012. http://artofsoftware.org/2012/09/13/
derivation-of-bias-variance-decomposition/.