train.py
def check_improvement(testval, ratio, gold, gold_i, current_i, want_bigger):
    '''Function that computes if training has improved.

    Returns a tuple: (best_val, i, to_snap)'''

    #indicators that we are at the first testing iteration and just need to return.
    if gold==np.inf or gold==0:
        return (testval, current_i, True)

    best_val=gold
    i=gold_i
    to_snap=False

    if want_bigger:
        if (testval-gold) / gold > ratio:
            best_val=testval
            i=current_i
            to_snap=True
    else:
        if (gold-testval) / gold > ratio:
            best_val=testval
            i=current_i
            to_snap=True

    return (best_val, i, to_snap)
Function that computes if training has improved.

    Returns a tuple: (best_val, i, to_snap)
Function that computes if training has improved.
Function that computes if training has improved .
def check_improvement(testval, ratio, gold, gold_i, current_i, want_bigger):
    if gold==np.inf or gold==0:
        return (testval, current_i, True)
    best_val=gold
    i=gold_i
    to_snap=False
    if want_bigger:
        if (testval-gold) / gold > ratio:
            best_val=testval
            i=current_i
            to_snap=True
    else:
        if (gold-testval) / gold > ratio:
            best_val=testval
            i=current_i
            to_snap=True
    return (best_val, i, to_snap)
def check_improvement ( testval , ratio , gold , gold_i , current_i , want_bigger ) : if gold == np . inf or gold == 0 : return ( testval , current_i , True ) best_val = gold i = gold_i to_snap = False if want_bigger : if ( testval - gold ) / gold > ratio : best_val = testval i = current_i to_snap = True else : if ( gold - testval ) / gold > ratio : best_val = testval i = current_i to_snap = True return ( best_val , i , to_snap )
Function that computes if training has improved.
Function that computes if training has improved .
'''Function that computes if training has improved.

    Returns a tuple: (best_val, i, to_snap)''' #indicators that we are at the first testing iteration and just need to return.
testval
ratio
gold
gold_i
current_i
want_bigger