33from pymc import Bernoulli , Censored , Mixture
44from pymc .aesaraf import floatX
55from pymc .distributions import (
6+ Dirichlet ,
67 DirichletMultinomial ,
78 HalfNormal ,
89 KroneckerNormal ,
@@ -55,7 +56,8 @@ def setup_class(self):
5556 # Nested SymbolicRV
5657 comp_1 = ZeroInflatedPoisson .dist (0.5 , 5 )
5758 comp_2 = Censored .dist (Bernoulli .dist (0.5 ), - 1 , 1 )
58- nested_mix = Mixture ("nested_mix" , [0.5 , 0.5 ], [comp_1 , comp_2 ])
59+ w = Dirichlet ("w" , [1 , 1 ])
60+ nested_mix = Mixture ("nested_mix" , w , [comp_1 , comp_2 ])
5961
6062 # Expected value of outcome
6163 mu = Deterministic ("mu" , floatX (alpha + dot (X , b )))
@@ -86,7 +88,7 @@ def setup_class(self):
8688 # add a potential as well
8789 pot = Potential ("pot" , mu ** 2 )
8890
89- self .distributions = [alpha , sigma , mu , b , Z , nb2 , zip , nested_mix , Y_obs , pot ]
91+ self .distributions = [alpha , sigma , mu , b , Z , nb2 , zip , w , nested_mix , Y_obs , pot ]
9092 self .deterministics_or_potentials = [mu , pot ]
9193 # tuples of (formatting, include_params
9294 self .formats = [("plain" , True ), ("plain" , False ), ("latex" , True ), ("latex" , False )]
@@ -99,8 +101,9 @@ def setup_class(self):
99101 r"Z ~ MvNormal(f(), f())" ,
100102 r"nb_with_p_n ~ NegBinom(10, nbp)" ,
101103 r"zip ~ MarginalMixture(f(), DiracDelta(0), Poisson(5))" ,
104+ r"w ~ Dirichlet(<constant>)" ,
102105 (
103- r"nested_mix ~ MarginalMixture(<constant> , "
106+ r"nested_mix ~ MarginalMixture(w , "
104107 r"MarginalMixture(f(), DiracDelta(0), Poisson(5)), "
105108 r"Censored(Bern(0.5), -1, 1))"
106109 ),
@@ -115,6 +118,7 @@ def setup_class(self):
115118 r"Z ~ MvNormal" ,
116119 r"nb_with_p_n ~ NegBinom" ,
117120 r"zip ~ MarginalMixture" ,
121+ r"w ~ Dirichlet" ,
118122 r"nested_mix ~ MarginalMixture" ,
119123 r"Y_obs ~ Normal" ,
120124 r"pot ~ Potential" ,
@@ -127,8 +131,9 @@ def setup_class(self):
127131 r"$\text{Z} \sim \operatorname{MvNormal}(f(),~f())$" ,
128132 r"$\text{nb_with_p_n} \sim \operatorname{NegBinom}(10,~\text{nbp})$" ,
129133 r"$\text{zip} \sim \operatorname{MarginalMixture}(f(),~\text{\$\operatorname{DiracDelta}(0)\$},~\text{\$\operatorname{Poisson}(5)\$})$" ,
134+ r"$\text{w} \sim \operatorname{Dirichlet}(\text{<constant>})$" ,
130135 (
131- r"$\text{nested_mix} \sim \operatorname{MarginalMixture}(\text{<constant> },"
136+ r"$\text{nested_mix} \sim \operatorname{MarginalMixture}(\text{w },"
132137 r"~\text{\$\operatorname{MarginalMixture}(f(),~\text{\\$\operatorname{DiracDelta}(0)\\$},~\text{\\$\operatorname{Poisson}(5)\\$})\$},"
133138 r"~\text{\$\operatorname{Censored}(\text{\\$\operatorname{Bern}(0.5)\\$},~-1,~1)\$})$"
134139 ),
@@ -143,6 +148,7 @@ def setup_class(self):
143148 r"$\text{Z} \sim \operatorname{MvNormal}$" ,
144149 r"$\text{nb_with_p_n} \sim \operatorname{NegBinom}$" ,
145150 r"$\text{zip} \sim \operatorname{MarginalMixture}$" ,
151+ r"$\text{w} \sim \operatorname{Dirichlet}$" ,
146152 r"$\text{nested_mix} \sim \operatorname{MarginalMixture}$" ,
147153 r"$\text{Y_obs} \sim \operatorname{Normal}$" ,
148154 r"$\text{pot} \sim \operatorname{Potential}$" ,
0 commit comments