Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
losses = [57.4, 50.7, 40.9, 39.6 ,37.9, 37.5, 36.3, 35.7, 36.5, 35.13, 36.33, 34.37, 34.78, 34.67, 34.44, 35.2, 35.66, 32.47, 34.6, 34.7, 35.14, 34.5]
import numpy as np
vhist = []
patience = 10
bad_c = 0
use_bleu = False
for i in range(len(losses)):
loss = losses[i]
print "%d, loss: %.2f" % (i, loss)
vhist.append(loss)
if len(vhist) > patience and ((use_bleu and False) or (not use_bleu and loss >= np.array(vhist)[:-patience].min())):
bad_c += 1
print "bad_c incremented"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment