Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lectures/_static/lecture_specific/optgrowth_fast/ogm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@
class OptimalGrowthModel:

def __init__(self,
rng,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the changing the API of how the object is created. Since this code snippet might be directly used in the lecture, it can break that lecture. Maybe it would be good to keep the params of __init__ method as it and update the function code instead.

α=0.4,
β=0.96,
μ=0,
s=0.1,
grid_max=4,
grid_size=120,
shock_size=250,
seed=1234):
shock_size=250):

self.α, self.β, self.μ, self.s = α, β, μ, s

# Set up grid
self.grid = np.linspace(1e-5, grid_max, grid_size)

# Store shocks (with a seed, so results are reproducible)
np.random.seed(seed)
self.shocks = np.exp(μ + s * np.random.randn(shock_size))
# Store shocks (drawn from the passed-in rng, so results are reproducible)
self.shocks = np.exp(μ + s * rng.standard_normal(shock_size))


def f(self, k):
Expand Down
Loading