def expect_log_sticks(sticks):
 dig_sum = psi(np.sum(sticks, 0))
 ElogW = (psi(sticks[0]) - dig_sum)
 Elog1_W = (psi(sticks[1]) - dig_sum)
 n = (len(sticks[0]) + 1)
 Elogsticks = np.zeros(n)
 Elogsticks[0:(n - 1)] = ElogW
 Elogsticks[1:] = (Elogsticks[1:] + np.cumsum(Elog1_W))
 return Elogsticks

def expect_log_sticks ( sticks ) : dig_sum = psi ( np . sum ( sticks , 0 ) ) ElogW = ( psi ( sticks [ 0 ] ) - dig_sum ) Elog1_W = ( psi ( sticks [ 1 ] ) - dig_sum ) n = ( len ( sticks [ 0 ] ) + 1 ) Elogsticks = np . zeros ( n ) Elogsticks [ 0 : ( n - 1 ) ] = ElogW Elogsticks [ 1 : ] = ( Elogsticks [ 1 : ] + np . cumsum ( Elog1_W ) ) return Elogsticks
for stick-breaking hdp .