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

Function generate_poetry

rnn_class/srn_language.py:217–228  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215 rnn.save('RNN_D30_M30_epochs2000_relu.npz')
216
217def generate_poetry():
218 sentences, word2idx = get_robert_frost()
219 rnn = SimpleRNN.load('RNN_D30_M30_epochs2000_relu.npz', T.nnet.relu)
220
221 # determine initial state distribution for starting sentences
222 V = len(word2idx)
223 pi = np.zeros(V)
224 for sentence in sentences:
225 pi[sentence[0]] += 1
226 pi /= pi.sum()
227
228 rnn.generate(pi, word2idx)
229
230def wikipedia():
231 sentences, word2idx = get_wikipedia_data()

Callers 1

srn_language.pyFile · 0.70

Calls 3

get_robert_frostFunction · 0.90
loadMethod · 0.45
generateMethod · 0.45

Tested by

no test coverage detected