Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
Bio.NeuralNetwork.Training.ExampleManager Class Reference

List of all members.

Public Member Functions

def __init__
def add_examples

Public Attributes

 train_examples
 validation_examples
 test_examples
 training_percent
 validation_percent

Detailed Description

Manage a grouping of Training Examples.

This is meant to make it easy to split a bunch of training examples
into three types of data:

o Training Data -- These are the data used to do the actual training
of the network.

o Validation Data -- These data are used to validate the network
while training. They provide an independent method to evaluate how
the network is doing, and make sure the network gets trained independent
of noise in the training data set.

o Testing Data -- The data which are used to verify how well a network
works. They should not be used at all in the training process, so they
provide a completely independent method of testing how well a network
performs.

Definition at line 16 of file Training.py.


Constructor & Destructor Documentation

def Bio.NeuralNetwork.Training.ExampleManager.__init__ (   self,
  training_percent = .4,
  validation_percent = .4 
)
Initialize the manager with the training examples.

Arguments:

o training_percent - The percentage of the training examples that
should be used for training the network.

o validation_percent - Percent of training examples for validating
a network during training.

Attributes:

o train_examples - A randomly chosen set of examples for training
purposes.

o valdiation_examples - Randomly chosesn set of examples for
use in validation of a network during training.

o test_examples - Examples for training purposes.

Definition at line 35 of file Training.py.

00035 
00036     def __init__(self, training_percent = .4, validation_percent = .4):
00037         """Initialize the manager with the training examples.
00038 
00039         Arguments:
00040 
00041         o training_percent - The percentage of the training examples that
00042         should be used for training the network.
00043 
00044         o validation_percent - Percent of training examples for validating
00045         a network during training.
00046 
00047         Attributes:
00048 
00049         o train_examples - A randomly chosen set of examples for training
00050         purposes.
00051 
00052         o valdiation_examples - Randomly chosesn set of examples for
00053         use in validation of a network during training.
00054 
00055         o test_examples - Examples for training purposes.
00056         """
00057         assert training_percent + validation_percent <= 1.0, \
00058                "Training and validation percentages more than 100 percent"
00059         
00060         self.train_examples = []
00061         self.validation_examples = []
00062         self.test_examples = []
00063 
00064         self.training_percent = training_percent
00065         self.validation_percent = validation_percent

Here is the caller graph for this function:


Member Function Documentation

def Bio.NeuralNetwork.Training.ExampleManager.add_examples (   self,
  training_examples 
)
Add a set of training examples to the manager.

Arguments:

o training_examples - A list of TrainingExamples to manage.

Definition at line 66 of file Training.py.

00066 
00067     def add_examples(self, training_examples):
00068         """Add a set of training examples to the manager.
00069 
00070         Arguments:
00071 
00072         o training_examples - A list of TrainingExamples to manage.
00073         """
00074         placement_rand = random.Random()
00075         
00076         # assign exact example randomly to the example types
00077         for example in training_examples:
00078             chance_num = placement_rand.random()
00079             # assign with the specified percentage
00080             if chance_num <= self.training_percent:
00081                 self.train_examples.append(example)
00082             elif chance_num <= (self.training_percent +
00083                                 self.validation_percent):
00084                 self.validation_examples.append(example)
00085             else:
00086                 self.test_examples.append(example)
00087         
00088                 
00089         
00090         

Member Data Documentation

Definition at line 61 of file Training.py.

Definition at line 59 of file Training.py.

Definition at line 63 of file Training.py.

Definition at line 60 of file Training.py.

Definition at line 64 of file Training.py.


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