def _update_stick_weights(self, counts, alpha): reverse_cumsum = counts[::-1].cumsum()[::-1] a = 1 + counts[:-1] b = alpha + reverse_cumsum[1:] stick_weights, mixture_weights = stick_break_proc(a, b) return stick_weights, mixture_weights
def _update_stick_weights(self, counts, beta, alpha0): new_weights = np.zeros((self.ngroups, self.ncomp)) new_stick_weights = np.zeros((self.ngroups, self.ncomp - 1)) for j in xrange(self.ngroups): reverse_cumsum = counts[j][::-1].cumsum()[::-1] a = alpha0 * beta[:-1] + counts[j][:-1] b = alpha0 * (1 - beta[:-1].cumsum()) + reverse_cumsum[1:] sticksj, weightsj = stick_break_proc(a, b) new_weights[j] = weightsj new_stick_weights[j] = sticksj return new_stick_weights, new_weights
def _update_stick_weights(self, counts, beta, alpha0): new_weights = np.zeros((self.ngroups, self.ncomp)) new_stick_weights = np.zeros((self.ngroups, self.ncomp-1)) for j in xrange(self.ngroups): reverse_cumsum = counts[j][::-1].cumsum()[::-1] a = alpha0*beta[:-1] + counts[j][:-1] b = alpha0*(1-beta[:-1].cumsum()) + reverse_cumsum[1:] sticksj, weightsj = stick_break_proc(a, b) new_weights[j] = weightsj new_stick_weights[j] = sticksj return new_stick_weights, new_weights