@@ -629,10 +629,18 @@ def logp(value, n, a):
629
629
-------
630
630
TensorVariable
631
631
"""
632
+ n = intX (n )
633
+ a = floatX (a )
634
+ if value .ndim >= 1 :
635
+ n = at .shape_padright (n )
636
+ if a .ndim > 1 :
637
+ a = at .shape_padleft (a )
638
+
632
639
sum_a = a .sum (axis = - 1 , keepdims = True )
633
640
const = (gammaln (n + 1 ) + gammaln (sum_a )) - gammaln (n + sum_a )
634
641
series = gammaln (value + a ) - (gammaln (value + 1 ) + gammaln (a ))
635
642
result = const + series .sum (axis = - 1 , keepdims = True )
643
+
636
644
# Bounds checking to confirm parameters and data meet all constraints
637
645
# and that each observation value_i sums to n_i.
638
646
return bound (
@@ -811,7 +819,7 @@ def logp(self, X):
811
819
812
820
813
821
def WishartBartlett (name , S , nu , is_cholesky = False , return_cholesky = False , initval = None ):
814
- R """
822
+ r """
815
823
Bartlett decomposition of the Wishart distribution. As the Wishart
816
824
distribution requires the matrix to be symmetric positive semi-definite
817
825
it is impossible for MCMC to ever propose acceptable matrices.
@@ -1392,12 +1400,7 @@ def logp(self, x):
1392
1400
result = _lkj_normalizing_constant (eta , n )
1393
1401
result += (eta - 1.0 ) * at .log (det (X ))
1394
1402
return bound (
1395
- result ,
1396
- X >= - 1 ,
1397
- X <= 1 ,
1398
- matrix_pos_def (X ),
1399
- eta > 0 ,
1400
- broadcast_conditions = False ,
1403
+ result , X >= - 1 , X <= 1 , matrix_pos_def (X ), eta > 0 , broadcast_conditions = False
1401
1404
)
1402
1405
1403
1406
def _distr_parameters_for_repr (self ):
0 commit comments