Skip to content

Instantly share code, notes, and snippets.

@ozancaglayan
Created February 20, 2016 18:55
Show Gist options
  • Save ozancaglayan/2ef385fb840178cc9612 to your computer and use it in GitHub Desktop.
Save ozancaglayan/2ef385fb840178cc9612 to your computer and use it in GitHub Desktop.
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