def emit(self, length, random_series): bprobs = [[ p for (patch, p) in zip(self.alloc, self.bprobs) if patch == a ] for a in [0, 1]] source = self.transition_matrix.emit(random_series) result = numpy.zeros([length], int) for i in range(length): patch = next(source) - 1 result[i] = argpick(bprobs[patch], random_series) return result
def emit(self, length, random_series): result = numpy.zeros([length], int) for i in range(length): result[i] = argpick(self.bprobs, random_series) return result