Skip to Main Content
Python 机器学习实践:测试驱动的开发方法
book

Python 机器学习实践:测试驱动的开发方法

by Matthew Kirk
January 2018
Intermediate to advanced content levelIntermediate to advanced
211 pages
8h 31m
Chinese
China Machine Press
Content preview from Python 机器学习实践:测试驱动的开发方法
隐马尔可夫模型
93
p_fwd = 0.0
for(k in self.states):
p_fwd += f_previous[k] * self.transition_probability[k][self.end_state]
{'probability': p_fwd, 'sequence': forward}
The forward algorithm will go through each state at each observation and multiply
them together to get a forward probability of how the state works in this given con‐
text. Next, we need to define the backward algorithm, which is:
class ForwardBackward:
# __init__
# forward
def backward():
backward = []
b_prev = {}
for(i in xrange(len(self.observations), 0, -1)):
b_curr = {}
for(state in self.states):
if i == 0:
b_curr[state] = self.transition_probability[state][self.end_state]
else: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Python for Bioinformatics

Mastering Python for Bioinformatics

Ken Youens-Clark

Publisher Resources

ISBN: 9787111581666