# HG changeset patch # User Pascal Lamblin # Date 1242424073 14400 # Node ID 28da8bb76336bc3f25c5ef89022f0e246d11aaaa # Parent 2f5fa4faf8311b28cdfb4825cf57311920646fbd Add another kind of early stopper diff -r 2f5fa4faf831 -r 28da8bb76336 pylearn/algorithms/stopper.py --- a/pylearn/algorithms/stopper.py Thu May 14 20:01:04 2009 -0400 +++ b/pylearn/algorithms/stopper.py Fri May 15 17:47:53 2009 -0400 @@ -123,3 +123,26 @@ return ICML08Stopper(hard_limit, v_int, 1.0, 1.0, hard_limit) +class NIPS09Stopper(Stopper): + """This stoppers stops if... + n_iter_max iterations have happened since the beginning, + OR (training error is below train_error_min + AND (n_iter_max * patience iterations have happened since last minimum + OR validation error gets higher than its minimum * valid_aumentation_max)) + """ + + def __init__(self, n_iter_max, train_error_min=float('inf'), patience=0.1, + valid_augmentation_max=1.1, set_score_interval=1): + self.n_iter_max = n_iter_max + self.train_error_min = train_error_min + self.patience = patience + self.valid_augmentation_max = valid_augmentation_max + self.set_score_interval = set_score_interval + + self.best_train = float('inf') + self.best_valid = float('inf') + self.best_valid_iter = -1 + + self.set_score = False + self.score = None +