Exemplo n.º 1
0
seq, targets, tokens = c.encode(n_seq, n_steps, tokens, fs)
_, __, n_in = seq.shape

t0 = time.time()

#Creates the model to run the RNN.
params = {
		'n_in': n_in,
		'n_hid': n_hid,
		'n_out': n_out,
		'n_epochs': 250
	}

model = Model(logger, params)

#Trains the RNN and runs the softmax signal.
while seq is not None and targets is not None:
	model.fit(seq, targets, validation_freq=1000)

	seqs = xrange(n_seq)
	for seq_num in seqs:
		tsm = time.time()
		guess = model.predict_probability(seq[seq_num])

		tsm = time.time() - tsm
		softmax_time += tsm
		logger.info("Softmax elapsed time: %f" % (tsm))

	seq, targets, tokens = c.encode(n_seq, n_steps, tokens, fs)

logger.info("Total elapsed time: {} and softmax time: {} ".format(time.time() - t0, softmax_time))