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
Labeled income process #1189
Merged
Merged
Labeled income process #1189
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
6768bd0
Merge remote-tracking branch 'econ-ark/master'
Mv77 3b5c754
Use labeled dstn for income process
Mv77 591dd53
Merge remote-tracking branch 'econ-ark/master'
Mv77 12fc4bf
Merge branch 'master' into plumbing/label-income
Mv77 08c627c
Fix MarkovModel
Mv77 daf2afd
Update examples
Mv77 1f948a5
Add a typecheck for the RNG setter
Mv77 a958700
Add seed setter and tests
Mv77 0d47789
Reset RNG when seed is updated
Mv77 6ea4775
Make the joint income + risky distribution labeled
Mv77 bca2703
Use labeled distributions and vectorized expectations in ConsPortfolio
Mv77 c78f666
Lint
Mv77 5c2da4d
Fix shape-related bugs
Mv77 eb4c0fc
Merge branch 'master' of https://github.com/econ-ark/HARK
Mv77 b5f0f52
Merge branch 'master' into plumbing/label-income
Mv77 b258663
Solve tabs bug
Mv77 2c9f8a0
Merge branch 'master' of https://github.com/econ-ark/HARK
Mv77 274cd69
Merge branch 'master' into plumbing/label-income
Mv77 bc755f1
Update RNG and seed setters
Mv77 1f6a416
Update CHANGELOG.md
Mv77 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
np.random.RandomState(value)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure? What does this property do?
I wrote as it is because I thought that the
get
andset
method should deal with exactly the same object. Since the getter isHARK/HARK/distribution.py
Lines 1188 to 1193 in daf2afd
I wrote the setter to the RNG property directly. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is how we initialize a random state with a seed. When we initialize a DiscreteDsitribution object, we set RNG as follows
HARK/HARK/distribution.py
Line 1079 in daf2afd
so I guess we would have to do
dist.RNG = np.random.RandomState(seed)
.Actually I guess this isn't a problem, you just have to be more explicit that the
value
parameter should be of typeRandomState
. Maybe just a type check?But also if we have a setter for
dist.seed = value
it should also generate a new RNG.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the typecheck solution.
You did not add a setter for the seed property (I think?) Should I create one? Would that go in a different PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be useful to have a seed setter. I think it would be fine to go in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alrighty, added a typecheck.
I could not remember why I had to add this setter in the first place, but just ran some tests and found out. The reason was that methods like
initialize_sim
callDistribution.reset()
on things like the income distribution. That method isHARK/HARK/distribution.py
Lines 24 to 31 in 20645e2
So without a setter, it failed