changeset 697:28da8bb76336

Add another kind of early stopper
author Pascal Lamblin <lamblinp@iro.umontreal.ca>
date Fri, 15 May 2009 17:47:53 -0400
parents 2f5fa4faf831
children 12237ae37452
files pylearn/algorithms/stopper.py
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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
+