Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix simulation performance of AggShockMarkovConsumerType #702

Merged
merged 10 commits into from
Jun 18, 2020

Conversation

mnwhite
Copy link
Contributor

@mnwhite mnwhite commented May 26, 2020

Implementation of DiscreteDistribution in AggShockMarkovConsumerType was incomplete/awkward, leading to extreme performance problems for simulation. Now fixed.

Also removed references to timeFwd() in one of the examples, and maybe a couple other comment or whitespace tweaks that happened to be in my active changes.

mnwhite added 2 commits May 26, 2020 12:40
DiscreteDistribution class was implemented awkwardly in AggShockMarkovConsumerType.getShocks(), leading to extremely slow simulation (15x worse performance in relevant example).  Simplified shock drawing code, timing issue fixed.

Also further cleaned up DiscreteDistribution.drawDiscrete(), as the exact_match version did not work correctly with multiple shock dimensions.
@mnwhite
Copy link
Contributor Author

mnwhite commented May 26, 2020

This includes my other two recent PRs. See those threads for other explanation.

@sbenthall
Copy link
Contributor

By "other recent PRs" you mean #690 and #698 ?

@sbenthall
Copy link
Contributor

There are some edits to examples/ConsumptionSaving/example_ConsAggShockModel.py and examples/ConsumptionSaving/example_ConsIndShock.py.

There are also .ipynb versions of these examples.

Ideally, the two are synced up. I'm a little confused at this point as to why they aren't. We've been using jupyter lab/jupytext to keep those working together.

@sbenthall
Copy link
Contributor

If the performance issue has been fixed, could you also reenable the automated test?

@mnwhite
Copy link
Contributor Author

mnwhite commented May 27, 2020 via email

@MridulS
Copy link
Member

MridulS commented May 27, 2020 via email

@sbenthall sbenthall mentioned this pull request May 27, 2020
@sbenthall
Copy link
Contributor

Let's put the jupytext thing into the contributor guidelines

@mnwhite
Copy link
Contributor Author

mnwhite commented Jun 4, 2020

We'll need to adjust the target for one AggShock test due to the change in the RNG. This test doesn't fully solve, but instead "quits early", so the distribution of shocks matters for the "result".

RNG changes in other commit moved a test target; now fixed (hopefully).
@mnwhite
Copy link
Contributor Author

mnwhite commented Jun 4, 2020

Tests are now passing, will be ready to merge soon.

@mnwhite
Copy link
Contributor Author

mnwhite commented Jun 18, 2020

This is ready to be merged again.

@llorracc llorracc merged commit 0c5a315 into master Jun 18, 2020
@MridulS MridulS deleted the SimPerformance branch August 24, 2020 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants