Skip to content
Snippets Groups Projects
Commit f86261c0 authored by Michael Langguth's avatar Michael Langguth
Browse files

Make set_model_saver_flag-method more verbose.

parent 6a5e12f7
No related branches found
No related tags found
No related merge requests found
...@@ -469,12 +469,17 @@ class TrainModel(object): ...@@ -469,12 +469,17 @@ class TrainModel(object):
:return flag: True if model should be saved :return flag: True if model should be saved
:return loss_avg: updated minimum loss :return loss_avg: updated minimum loss
""" """
method = TrainModel.set_model_saver_flag.__name__
save_flag = False save_flag = False
if len(losses) <= niter_steps*2: if len(losses) <= niter_steps*2:
loss_avg = old_min_loss loss_avg = old_min_loss
return save_flag, loss_avg return save_flag, loss_avg
loss_avg = np.mean(losses[-niter_steps:]) loss_avg = np.mean(losses[-niter_steps:])
# print diagnosis
print("%{0}: Current loss: {1:.4f}, old minimum: {2:.4f}, model will be saved: {3}"
.format(method, loss_avg, old_min_loss, loss_avg < old_min_loss))
if loss_avg < old_min_loss: if loss_avg < old_min_loss:
save_flag = True save_flag = True
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment