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

Add seed as property of DiscreteDstnLabeled #1184

Merged
merged 2 commits into from
Oct 26, 2022

Conversation

Mv77
Copy link
Contributor

@Mv77 Mv77 commented Oct 25, 2022

I'm starting to use @alanlujan91 's excellent DDL tools.

I noticed a small bug. Some of the discrete distribution features that are extended to DDL expect to be able to access DDL.seed. However, the seed is located in DDL.dataset.seed; requesting DDL.seed returns an error.

This PR fixes the bug by declaring the seed as a property.

Here is an example of code that fails for me without this fix

from HARK.distribution import DiscreteDistributionLabeled
import numpy as np

my_dstn = DiscreteDistributionLabeled(
    pmv = np.array([0.5,0.5]),
    data = np.array([-1,1]),
    var_names = ['my_var']
)
my_dstn.dataset

sq_dstn = my_dstn.dist_of_func(lambda x: x['my_var']**2)
sq_dstn.atoms
  • Tests for new functionality/models or Tests to reproduce the bug-fix in code.
  • Updated documentation of features that add new functionality.
  • Update CHANGELOG.md with major/minor changes.

@Mv77 Mv77 requested a review from alanlujan91 October 25, 2022 22:15
@Mv77 Mv77 added the Ready-To-Merge Has been reviewed and when branch is updated and checks pass it should be merged label Oct 25, 2022
Copy link
Member

@alanlujan91 alanlujan91 left a comment

Choose a reason for hiding this comment

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

Yep! this looks good! glad you found DDL useful!

@alanlujan91 alanlujan91 merged commit 8577e31 into econ-ark:master Oct 26, 2022
@Mv77 Mv77 deleted the plumbing/ddl-seed branch October 26, 2022 21:38
@sbenthall sbenthall added this to the 0.13.0 milestone Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready-To-Merge Has been reviewed and when branch is updated and checks pass it should be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants