def makeLeftRightHMM(self, nStates, pD, obsData, lData=None): if nStates <= 0: print 'Number of states must be > 0' if lData is None: lData = obsData.shape[1] D = np.mean(lData) D = D / nStates mc = self.initLeftRightMC(nStates, D) hmm = HMM(mc, pD) hmm = hmm.init(hmm, obsData, lData) hmm, logprobs = hmm.train(hmm, obsData, lData, 5, np.log(1.01)) return hmm