Logo Search packages:      
Sourcecode: python-biopython version File versions  Download package

def test_NNGeneral::ExampleManagerTest::test_adding_examples (   self )
Make sure test examples are added properly.

Definition at line 54 of file test_NNGeneral.py.

                                  :
        """Make sure test examples are added properly.
        """
        manager = ExampleManager()

        # figure out the expected number of examples in each category
        expected_train = manager.training_percent * self.num_examples
        expected_validation = manager.validation_percent * self.num_examples
        expected_test = self.num_examples - expected_train \
                        - expected_validation

        manager.add_examples(self.examples)

        for expect, actual in [(expected_train, len(manager.train_examples)),
                               (expected_validation,
                                len(manager.validation_examples)),
                               (expected_test, len(manager.test_examples))]:
            
            wrong_percent = abs(expect - actual) / self.num_examples
            assert wrong_percent < .1, \
                   "Deviation in how examples were added, expect %s, got %s" \
                   % (expect, actual)
        

Generated by  Doxygen 1.6.0   Back to index