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

labels argument doesn't work for distribution.expected #1487

Open
sbenthall opened this issue Aug 16, 2024 · 0 comments
Open

labels argument doesn't work for distribution.expected #1487

sbenthall opened this issue Aug 16, 2024 · 0 comments
Assignees
Milestone

Comments

@sbenthall
Copy link
Contributor

This code:

from HARK.distribution import expected, Normal, DiscreteDistributionLabeled

gamma = DiscreteDistributionLabeled.from_unlabeled(
    Normal(mu= 0, sigma = 1).discretize(**{"N" : 7}), var_names=["gamma"]
)

expected(func=lambda x: x, dist=gamma, labels=True)

Gets this error:

TypeError: <lambda>() got an unexpected keyword argument 'labels'

Even though the labels keyword argument to expected is explicitly supported in the documentation.

    labels : bool
        If True, the function should use labeled indexing instead of integer
        indexing using the distribution's underlying rv coordinates. For example,
        if `dims = ('rv', 'x')` and `coords = {'rv': ['a', 'b'], }`, then
        the function can be `lambda x: x["a"] + x["b"]`.

https://github.com/econ-ark/HARK/blob/master/HARK/distribution.py#L2422

@sbenthall sbenthall added this to the 1.0.0 milestone Aug 16, 2024
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

No branches or pull requests

2 participants