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

Cannot make a DiscreteDistributionLabeled from a Bernoulli variable #1431

Closed
sbenthall opened this issue May 22, 2024 · 1 comment · Fixed by #1432
Closed

Cannot make a DiscreteDistributionLabeled from a Bernoulli variable #1431

sbenthall opened this issue May 22, 2024 · 1 comment · Fixed by #1432
Assignees

Comments

@sbenthall
Copy link
Contributor

foo = Bernoulli(.4)
DiscreteDistributionLabeled.from_unlabeled(
               foo,
               var_names = ['foo']
            )
File ~/projects/HARK/HARK/distribution.py:1087, in DiscreteDistributionLabeled.from_unlabeled(cls, dist, name, attrs, var_names, var_attrs)
   1077 @classmethod
   1078 def from_unlabeled(
   1079     cls,
   (...)
   1084     var_attrs=None,
   1085 ):
   1086     ldd = cls(
-> 1087         dist.pmv,
   1088         dist.atoms,
   1089         seed=dist.seed,
   1090         limit=dist.limit,
   1091         name=name,
   1092         attrs=attrs,
   1093         var_names=var_names,
   1094         var_attrs=var_attrs,
   1095     )
   1097     return ldd

AttributeError: 'Bernoulli' object has no attribute 'pmv'
@alanlujan91
Copy link
Member

Bernouli is not a HARK.DiscreteDistribution, it is a scipy.DiscreteFrozenDistribution.

The subtle difference is that Bernouli is still a scipy object, and 'DiscreteDistributionLabeled.from_unlabeled' requires a HARK.DiscreteDistribution.

This should be an easy fix, I think.

alanlujan91 added a commit to alanlujan91/HARK that referenced this issue May 22, 2024
@alanlujan91 alanlujan91 mentioned this issue May 22, 2024
3 tasks
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 a pull request may close this issue.

2 participants