def SummaryAlg(*args): ''' Summarize pairwise potentials of single HMM sequence. Related ------- SummaryAlg_py Returns ------- TransStateCount Htable ''' if cppReady() and PlatformConfig['FwdBwdImpl'] == "cpp": return SummaryAlg_cpp(*args) else: return SummaryAlg_py(*args)
def FwdAlg(PiInit, PiMat, SoftEv): ''' Forward algorithm for a single HMM sequence. Wrapper for py/cpp. Related ------- FwdAlg_py Returns ------- fmsg : 2D array, size T x K fmsg[t,k] = p( z[t,k] = 1 | x[1] ... x[t] ) margPrObs : 1D array, size T margPrObs[t] = p( x[t] | x[1], x[2], ... x[t-1] ) ''' if cppReady() and PlatformConfig['FwdBwdImpl'] == "cpp": return FwdAlg_cpp(PiInit, PiMat, SoftEv) else: return FwdAlg_py(PiInit, PiMat, SoftEv)
def BwdAlg(PiInit, PiMat, SoftEv, margPrObs): ''' Backward algorithm for a single HMM sequence. Wrapper for BwdAlg_py/BwdAlg_cpp. Related ------- BwdAlg_py Returns ------- bmsg : 2D array, size TxK bmsg[t,k] = p( x[t+1], x[t+2], ... x[T] | z[t,k] = 1 ) ------------------------------------- p( x[t+1], x[t+2], ... x[T] | x[1] ... x[t]) ''' if cppReady() and PlatformConfig['FwdBwdImpl'] == "cpp": return BwdAlg_cpp(PiInit, PiMat, SoftEv, margPrObs) else: return BwdAlg_py(PiInit, PiMat, SoftEv, margPrObs)