Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.NeuralNetwork.StopTraining.ValidationIncreaseStop Class Reference

List of all members.

Public Member Functions

def __init__
def stopping_criteria

Public Attributes

 verbose
 max_iterations
 min_iterations
 last_error

Detailed Description

Class to stop training on a network when the validation error increases.

Normally, during training of a network, the error will always decrease
on the set of data used in the training. However, if an independent
set of data is used for validation, the error will decrease to a point,
and then start to increase. This increase normally occurs due to the
fact that the network is starting to learn noise in the training data
set. This stopping criterion function will stop when the validation
error increases.

Definition at line 15 of file StopTraining.py.


Constructor & Destructor Documentation

def Bio.NeuralNetwork.StopTraining.ValidationIncreaseStop.__init__ (   self,
  max_iterations = None,
  min_iterations = 0,
  verbose = 0 
)
Initialize the stopping criterion class.

Arguments:

o max_iterations - The maximum number of iterations that
should be performed, regardless of error.

o min_iterations - The minimum number of iterations to perform,
to prevent premature stoppage of training.

o verbose - Whether or not the error should be printed during
training.

Definition at line 27 of file StopTraining.py.

00027 
00028                  verbose = 0):
00029         """Initialize the stopping criterion class.
00030 
00031         Arguments:
00032 
00033         o max_iterations - The maximum number of iterations that
00034         should be performed, regardless of error.
00035 
00036         o min_iterations - The minimum number of iterations to perform,
00037         to prevent premature stoppage of training.
00038 
00039         o verbose - Whether or not the error should be printed during
00040         training.
00041         """
00042         self.verbose = verbose
00043         self.max_iterations = max_iterations
00044         self.min_iterations = min_iterations
00045 
00046         self.last_error = None

Here is the caller graph for this function:


Member Function Documentation

def Bio.NeuralNetwork.StopTraining.ValidationIncreaseStop.stopping_criteria (   self,
  num_iterations,
  training_error,
  validation_error 
)
Define when to stop iterating.

Definition at line 48 of file StopTraining.py.

00048 
00049                           validation_error):
00050         """Define when to stop iterating.
00051         """
00052         if num_iterations % 10 == 0:
00053             if self.verbose:
00054                 print "%s; Training Error:%s; Validation Error:%s"\
00055                       % (num_iterations, training_error, validation_error)
00056 
00057         if num_iterations > self.min_iterations:
00058             if self.last_error is not None:
00059                 if validation_error > self.last_error:
00060                     if self.verbose:
00061                         print "Validation Error increasing -- Stop"
00062                     return 1
00063 
00064         if self.max_iterations is not None:
00065             if num_iterations > self.max_iterations:
00066                 if self.verbose:
00067                     print "Reached maximum number of iterations -- Stop"
00068                 return 1
00069 
00070         self.last_error = validation_error
00071         return 0

Member Data Documentation

Definition at line 45 of file StopTraining.py.

Definition at line 42 of file StopTraining.py.

Definition at line 43 of file StopTraining.py.

Definition at line 41 of file StopTraining.py.


The documentation for this class was generated from the following file: