Skip to content

Commit

Permalink
will print early terminate
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragav Venkatesan (Student) authored and Ragav Venkatesan (Student) committed Mar 13, 2017
1 parent 8327d05 commit 87a6c2d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions yann/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2608,7 +2608,7 @@ def cook(self, verbose = 2, **kwargs):
for param in params:
self.best_params.append(theano.shared(param.get_value(borrow = self.borrow)))

def print_status (self, epoch , verbose = 2):
def print_status (self, epoch , print_lr = False, verbose = 2):
"""
This function prints the cost of the current epoch, learning rate and momentum of the
network at the moment. This also calls the resultor to process results.
Expand All @@ -2633,9 +2633,11 @@ def print_status (self, epoch , verbose = 2):
lr = self.learning_rate.get_value(borrow = self.borrow)
mom = self.current_momentum(epoch)

if print_lr is True:
verbose = 3
self.cooked_resultor.process_results(cost = cost,
lr = lr,
mom = mom,
mom = mom,
verbose = verbose)

def _print_layer (self, id, prefix = " ", nest = True, last = True):
Expand Down Expand Up @@ -2908,7 +2910,7 @@ def train(self, verbose = 2, **kwargs):
epoch_counter = 0
early_termination = False
iteration= 0
era = 0
era = 0
if isinstance(epochs, int):
total_epochs = epochs
change_era = epochs + 1
Expand Down Expand Up @@ -3002,7 +3004,7 @@ def train(self, verbose = 2, **kwargs):
show_progress = show_progress,
verbose = verbose )
self.visualize ( epoch = epoch_counter , verbose = verbose )
self.print_status ( epoch = epoch_counter, verbose=verbose )
self.print_status ( epoch = epoch_counter, print_lr = True, verbose=verbose )
self.save_params ( epoch = epoch_counter, verbose = verbose )

if best is True:
Expand All @@ -3018,8 +3020,8 @@ def train(self, verbose = 2, **kwargs):
if patience < epoch_counter:
early_termination = True
if final_era is False:
if verbose >= 3:
print("... Patience ran out lowering learning rate.")
if verbose >= 2:
print(".. Patience ran out lowering learning rate.")
new_lr = self.learning_rate.get_value( borrow = self.borrow ) * 0.1
self._new_era(new_learning_rate = new_lr, verbose =verbose )
early_termination = False
Expand Down

0 comments on commit 87a6c2d

Please sign in to comment.