MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / sample_word

Function sample_word

hmm_class/frost.py:86–95  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

84
85# generate 4 lines
86def sample_word(d):
87 # print "d:", d
88 p0 = np.random.random()
89 # print "p0:", p0
90 cumulative = 0
91 for t, p in iteritems(d):
92 cumulative += p
93 if p0 < cumulative:
94 return t
95 assert(False) # should never get here
96
97def generate():
98 for i in range(4):

Callers 1

generateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected