3
3
from pymc import Bernoulli , Censored , Mixture
4
4
from pymc .aesaraf import floatX
5
5
from pymc .distributions import (
6
+ Dirichlet ,
6
7
DirichletMultinomial ,
7
8
HalfNormal ,
8
9
KroneckerNormal ,
@@ -55,7 +56,8 @@ def setup_class(self):
55
56
# Nested SymbolicRV
56
57
comp_1 = ZeroInflatedPoisson .dist (0.5 , 5 )
57
58
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 ])
59
61
60
62
# Expected value of outcome
61
63
mu = Deterministic ("mu" , floatX (alpha + dot (X , b )))
@@ -86,7 +88,7 @@ def setup_class(self):
86
88
# add a potential as well
87
89
pot = Potential ("pot" , mu ** 2 )
88
90
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 ]
90
92
self .deterministics_or_potentials = [mu , pot ]
91
93
# tuples of (formatting, include_params
92
94
self .formats = [("plain" , True ), ("plain" , False ), ("latex" , True ), ("latex" , False )]
@@ -99,8 +101,9 @@ def setup_class(self):
99
101
r"Z ~ MvNormal(f(), f())" ,
100
102
r"nb_with_p_n ~ NegBinom(10, nbp)" ,
101
103
r"zip ~ MarginalMixture(f(), DiracDelta(0), Poisson(5))" ,
104
+ r"w ~ Dirichlet(<constant>)" ,
102
105
(
103
- r"nested_mix ~ MarginalMixture(<constant> , "
106
+ r"nested_mix ~ MarginalMixture(w , "
104
107
r"MarginalMixture(f(), DiracDelta(0), Poisson(5)), "
105
108
r"Censored(Bern(0.5), -1, 1))"
106
109
),
@@ -115,6 +118,7 @@ def setup_class(self):
115
118
r"Z ~ MvNormal" ,
116
119
r"nb_with_p_n ~ NegBinom" ,
117
120
r"zip ~ MarginalMixture" ,
121
+ r"w ~ Dirichlet" ,
118
122
r"nested_mix ~ MarginalMixture" ,
119
123
r"Y_obs ~ Normal" ,
120
124
r"pot ~ Potential" ,
@@ -127,8 +131,9 @@ def setup_class(self):
127
131
r"$\text{Z} \sim \operatorname{MvNormal}(f(),~f())$" ,
128
132
r"$\text{nb_with_p_n} \sim \operatorname{NegBinom}(10,~\text{nbp})$" ,
129
133
r"$\text{zip} \sim \operatorname{MarginalMixture}(f(),~\text{\$\operatorname{DiracDelta}(0)\$},~\text{\$\operatorname{Poisson}(5)\$})$" ,
134
+ r"$\text{w} \sim \operatorname{Dirichlet}(\text{<constant>})$" ,
130
135
(
131
- r"$\text{nested_mix} \sim \operatorname{MarginalMixture}(\text{<constant> },"
136
+ r"$\text{nested_mix} \sim \operatorname{MarginalMixture}(\text{w },"
132
137
r"~\text{\$\operatorname{MarginalMixture}(f(),~\text{\\$\operatorname{DiracDelta}(0)\\$},~\text{\\$\operatorname{Poisson}(5)\\$})\$},"
133
138
r"~\text{\$\operatorname{Censored}(\text{\\$\operatorname{Bern}(0.5)\\$},~-1,~1)\$})$"
134
139
),
@@ -143,6 +148,7 @@ def setup_class(self):
143
148
r"$\text{Z} \sim \operatorname{MvNormal}$" ,
144
149
r"$\text{nb_with_p_n} \sim \operatorname{NegBinom}$" ,
145
150
r"$\text{zip} \sim \operatorname{MarginalMixture}$" ,
151
+ r"$\text{w} \sim \operatorname{Dirichlet}$" ,
146
152
r"$\text{nested_mix} \sim \operatorname{MarginalMixture}$" ,
147
153
r"$\text{Y_obs} \sim \operatorname{Normal}$" ,
148
154
r"$\text{pot} \sim \operatorname{Potential}$" ,
0 commit comments