# HG changeset patch # User Pascal Lamblin # Date 1243199798 14400 # Node ID fb9fb142098fe2b264f17e44343cf81ca6dbf5bf # Parent 8d5d42274bd10b1b84718d60f3f0a7794473b36d Bugfix and improvement to NIPS09Stopper diff -r 8d5d42274bd1 -r fb9fb142098f pylearn/sandbox/nips09stopper.py --- a/pylearn/sandbox/nips09stopper.py Fri May 22 15:14:34 2009 -0400 +++ b/pylearn/sandbox/nips09stopper.py Sun May 24 17:16:38 2009 -0400 @@ -32,14 +32,17 @@ def find_min(self, step, check, save): best = None while not self.stop: - self.iter++ + self.iter += 1 step() if (self.iter % self.set_score_interval == 0): self.train_score, self.valid_score = check() - if (self.valid_score < self.best_valid) and save: - self.best_valid = self.valid_score - self.best_valid_iter = self.iter - best = (save(), self.iter, self.valid_score) + if save: + if (self.valid_score < self.best_valid): + self.best_valid = self.valid_score + self.best_valid_iter = self.iter + best = [save(), self.iter, self.valid_score, self.iter] + else: + best[3] = self.iter if self.iter >= self.n_iter_max: self.stop = True