Commit bf7d5ec3 authored by hazrmard's avatar hazrmard
Browse files

made LSTM model updates and RL agent training non-verbose to address i/o error...

made LSTM model updates and RL agent training non-verbose to address i/o error bug fixed elsewhere in previous commit 521dd4
parent 521dd470
......@@ -133,7 +133,9 @@ def train_agent(agent, env, steps=30000, dest='agent_weights.h5f'):
* `store_weights`: Containing th reward trace
"""
store_weights = SaveBest(dest=dest)
agent.fit(env, nb_steps=steps, visualize=False, verbose=1, callbacks=[store_weights])
# Agent learning is not verbose. Otherwise i/o error will be raised when
# the script attempts to print on a remote terminal which is logged off:
agent.fit(env, nb_steps=steps, visualize=False, verbose=0, callbacks=[store_weights])
# save latest weights
# TODO: Should this be in production?
# agent.save_weights('./rl_results_local/latestweights.h5f')
......@@ -179,5 +181,5 @@ def test_agent(agent, env, weights='agent_weights.h5f', actions=[]) ->\
"""
test_perf_log = PerformanceMetrics()
agent.load_weights(weights)
agent.test(env, nb_episodes=1, visualize=False, verbose=2, callbacks=[test_perf_log])
agent.test(env, nb_episodes=1, visualize=False, verbose=0, callbacks=[test_perf_log])
return test_perf_log
......@@ -90,7 +90,10 @@ def retrain(model, data, epochs=25):
# callback to save best weights only
checkpoint = ModelCheckpoint('weights.best.hdf5',
monitor='val_loss',
verbose=1,
# Set verbose=0 to prevent i/o error when script
# is running on a remote terminal that is then
# logged out:
verbose=0,
save_best_only=True,
mode='min')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment