Professional Documents
Culture Documents
Numerical Methods
Lecture 5: Machine Learning Methods
Zachary R. Stangebye
Spring 2022
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
Machine Learning
Machine Learning
Machine Learning
Key Innovation
• Machine learning thus an umbrella term for a collection of
functional approximation algorithms that break the curse of
dimensionality
• Estimating/parameterizing f often referred to as “training”
Key Innovation
• Machine learning thus an umbrella term for a collection of
functional approximation algorithms that break the curse of
dimensionality
• Estimating/parameterizing f often referred to as “training”
1. Neural networks
2. Random forest models
3. Gaussian process regressions
4. ...
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
Key Innovation
• Machine learning thus an umbrella term for a collection of
functional approximation algorithms that break the curse of
dimensionality
• Estimating/parameterizing f often referred to as “training”
1. Neural networks
2. Random forest models
3. Gaussian process regressions
4. ...
In Economics...
• Economists finally starting to adopt these methods
In Economics...
• Economists finally starting to adopt these methods
For us...
• Approximate value/policy functions
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
For us...
• Approximate value/policy functions
• Basic idea
• Basic idea
Big-Picture Idea
• In search of a function V : RD → R
Big-Picture Idea
• In search of a function V : RD → R
f |X, θ ∼ N (f |m, K )
m(x1 ; θ )
m = m(X; θ ) =
..
.
m(xN ; θ )
m(x1 ; θ )
m = m(X; θ ) =
..
.
m(xN ; θ )
D
!
1 X (xi − xi0 )2
kSE (x, x 0 ; θ ) = s 2 exp −
2 li2
i=1
• Implies θ = {s, l1 , . . . , lD }
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
D
!
1 X (xi − xi0 )2
kSE (x, x 0 ; θ ) = s 2 exp −
2 li2
i=1
D
!
1 X (xi − xi0 )2
kSE (x, x 0 ; θ ) = s 2 exp −
2 li2
i=1
• Notice
• K has diagonal row of s 2
• li governs contribution of input/dimension i to correlation
across points
• As x → x 0 , correlation approaches 1. Implies continuously
differentiable functions
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
GPR Measurement
• Evaluate the equilibrium conditions at our guess/prior
t i = f (xi ), for i = 1, . . . , N
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
GPR Measurement
• Evaluate the equilibrium conditions at our guess/prior
t i = f (xi ), for i = 1, . . . , N
t i |f (x i ), sn ∼ N (t i |f (xi ), sn2 )
GPR Posterior
• Combine prior GP with likelihood to get posterior GP
f (·)|X, t, θ ∗ , sn∗ ∼ N f (·)|m̃(·), k̃(·, ·)
where
−1
m̃(x) = m(x; θ ∗ ) + K (x, X; θ ∗ ) K + (sn∗ )2 IN (t − m)
| {z } | {z } | {z }
1×N N×N N×1
and
−1
k̃(x, x0 ) = k(x, x0 ; θ ∗ )−K (x, X; θ ∗ ) K + (sn∗ )2 IN K (X, x; θ ∗ )
| {z } | {z } | {z }
1×N N×N N×1
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
• Equilibrium given by V = TV
• Optimal policy function: p(x) ∈ C(x)
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
Training Inputs
• In each iteration, select (5 to 10) × D training inputs (grid
points)
• This is where curse of dimensionality blatantly disappears!
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
Training Inputs
• In each iteration, select (5 to 10) × D training inputs (grid
points)
• This is where curse of dimensionality blatantly disappears!
Examples
b0
+ βEỹ 0 |y V (ỹ , b 0 )
V (y , b) = max u y − b +
b0 1+r
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
Examples
b0
+ βEỹ 0 |y V (ỹ , b 0 )
V (y , b) = max u y − b +
b0 1+r
Xergodic = {xi : 1 ≤ i ≤ n}
Xergodic = {xi : 1 ≤ i ≤ n}
Typical Sets
• Information-theoretic concept
Typical Sets
• Information-theoretic concept
0.4
0.3
0.2
0.1
0.0
-4 -2 0 2 4
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
0.4
0.3
0.2
0.1
0.0
-4 -2 0 2 4
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
1
q(y , b 0 ) = E 1{VR (ỹ 0 , b 0 ) ≥ VD (ỹ 0 )}
1+r
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
0.030
1.2
0.025
1.1
0.020
1.0 0.015
0.010
0.9
0.005
0.8
0
0.0 0.1 0.2 0.3
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
f (x) ≈ h(WT x)
for some W ∈ RD×d that projects the high-dimensional input
space the a lower-dimensionsal active subspace, Rd
• h : Rd → R is called the link function
• Repeat whole previous algorithm on h
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
Choosing W
1. Define a D × D matrix
Z
C = (∇f (x))(∇f (x))T ρ(x)dx
Choosing W
1. Define a D × D matrix
Z
C = (∇f (x))(∇f (x))T ρ(x)dx
Λ VT
C = VΛ
Choosing W
1. Define a D × D matrix
Z
C = (∇f (x))(∇f (x))T ρ(x)dx
Λ VT
C = VΛ
In practice
In practice
In practice
• Most interesting structural models have dimensionality
significantly less than 20
• Might not be true of more empirically oriented frameworks
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
In practice
• Most interesting structural models have dimensionality
significantly less than 20
• Might not be true of more empirically oriented frameworks
• But, could use this in following way. If you want to choose
parameters to match moments/calibrate
1. Add each parameter of interest as a dimension with
deterministic, constant law of motion
2. Solve model once
3. Select parameters as points in state space. Model dynamics
respond immediately
4. Can calibrate dozens of parameters while solving the model
only once
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
Alternate Algorithms
Alternate Algorithms
(
0, x ≤ 0
(ReLU) φ(x) =
x, x > 0
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
(
0, x ≤ 0
(ReLU) φ(x) =
x, x > 0
1
(Sigmoid) φ(x) =
1 + e −x
Basic GPR Framework Basic GPR Algorithm Extensions/Augmentations Neural Networks
(
0, x ≤ 0
(ReLU) φ(x) =
x, x > 0
1
(Sigmoid) φ(x) =
1 + e −x