ó
X<c           @   s<   d  Z  d d l Z d d d „  ƒ  YZ d d d „  ƒ  YZ d S(	   s;   Provide classes for dealing with Training Neural Networks.
iÿÿÿÿNt   TrainingExamplec           B   s   e  Z d  Z d d „ Z RS(   sT   Hold inputs and outputs of a training example.

    XXX Do I really need this? 
    t    c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t   namet   inputst   outputs(   t   selfR   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/NeuralNetwork/Training.pyt   __init__   s    		(   t   __name__t
   __module__t   __doc__R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/NeuralNetwork/Training.pyR       s   t   ExampleManagerc           B   s&   e  Z d  Z d d d „ Z d „  Z RS(   sá  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.
    gš™™™™™Ù?c         C   sM   | | d k s t  d ƒ ‚ g  |  _ g  |  _ g  |  _ | |  _ | |  _ d S(   se  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.
        g      ð?s9   Training and validation percentages more than 100 percentN(   t   AssertionErrort   train_examplest   validation_examplest   test_examplest   training_percentt   validation_percent(   R   R   R   (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/NeuralNetwork/Training.pyR   #   s    					c         C   sˆ   t  j ƒ  } xu | D]m } | j  ƒ  } | |  j k rG |  j j | ƒ q | |  j |  j k rp |  j j | ƒ q |  j j | ƒ q Wd S(   s   Add a set of training examples to the manager.

        Arguments:

        o training_examples - A list of TrainingExamples to manage.
        N(   t   randomt   RandomR   R   t   appendR   R   R   (   R   t   training_examplest   placement_randt   examplet
   chance_num(    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/NeuralNetwork/Training.pyt   add_examplesB   s    	(   R   R   R	   R   R   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/NeuralNetwork/Training.pyR
      s   (    (    (   R	   R   R    R
   (    (    (    s   /oak/stanford/groups/akundaje/marinovg/programs/biopython-1.50.tar.gz/biopython-1.50/build/lib.linux-x86_64-2.7/Bio/NeuralNetwork/Training.pyt   <module>   s   
