-
-
Notifications
You must be signed in to change notification settings - Fork 205
Closed
Labels
Description
Describe the bug
combine_indep_dstns fails with Bernoulli distributions.
To Reproduce
There are two distinct but perhaps related bugs.
First, the Bernoulli distribution has no dim() method:
b = Bernoulli(p=0.5)
combine_indep_dstns(*[b])
gets you:
File "/home/sb/projects/HARK/HARK/distributions/utils.py", line 406, in combine_indep_dstns
if len(dist.dim()) > 1:
^^^^^^^^
AttributeError: 'Bernoulli' object has no attribute 'dim'
Next, if you wrap this in a DiscreteDistributionLabeled, that also fails:
bl = DiscreteDistributionLabeled.from_unlabeled(Bernoulli(p=0.5), var_names='b')
combine_indep_dstns(*[bl])
gets you:
File "/home/sb/projects/HARK/HARK/distributions/utils.py", line 447, in <listcomp>
[distributions[i].limit["infimum"] for i in range(dstn_count)]
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'infimum'
Expected behavior
That these should "construct [the] joint discrete distribution" of the input Bernoulli, which is just the same Bernoulli.
Copilot