Beispiel #1
0
 def test_list_generator_from_minus_5_to_5(self) -> None:
     for value in RandomListGenerator(
             generator=RandomValueGenerator(-5, 5)).rand(10):
         self.assertAlmostEqual(0, value, delta=5)
         self.assertLess(value, 5, 'Cannot be greater than 5!')
         self.assertGreater(value, -5, 'Cannot be less than -5!')
     return None
Beispiel #2
0
 def prepare_dataset(self):
     self.__dataset = RandomPointDatasetGenerator(
         classifier=PointClassifier(classes=self.__classes),
         generator=RandomListGenerator(
             generator=RandomValueGenerator(),)
     ).commit_classified(self.__size)
     return RandomPointDatasetSplitter(self.__dataset).commit(ratio=self.__ratio)
Beispiel #3
0
 def test_list_generator_from_minus_1_to_1(self) -> None:
     for value in RandomListGenerator(
             generator=RandomValueGenerator()).rand(10):
         self.assertAlmostEqual(0, value, delta=1)
         self.assertLess(value, 1, 'Cannot be greater than 1!')
         self.assertGreater(value, -1, 'Cannot be less than -1!')
     return None
Beispiel #4
0
 def test_point_database_splitter_10000_samples(self):
     x_train, x_test, y_train, y_test = RandomPointDatasetSplitter(
         dataset=RandomPointDatasetGenerator(generator=RandomListGenerator(
             generator=RandomValueGenerator()),
                                             classifier=PointClassifier(12))
         .commit_classified(10000)).commit(.7)
     self.assertAlmostEqual(7000, len(x_train), delta=100)
     self.assertAlmostEqual(7000, len(y_train), delta=100)
     self.assertAlmostEqual(3000, len(x_test), delta=100)
     self.assertAlmostEqual(3000, len(y_test), delta=100)
Beispiel #5
0
 def test_point_dataset_generator_from_minus_5_to_5(self) -> None:
     for point in RandomPointDatasetGenerator(
             generator=RandomListGenerator(
                 generator=RandomValueGenerator(-5, 5)),
             classifier=PointClassifier(12)).commit_classified(1000):
         self.assertAlmostEqual(0, point[0][0], delta=5)
         self.assertAlmostEqual(0, point[0][1], delta=5)
         self.assertLess(point[0][0], 5,
                         'Point X coordinate cannot be greater than 5!')
         self.assertGreater(point[0][0], -5,
                            'Point X coordinate cannot be less than -5!')
         self.assertLess(point[0][1], 5,
                         'Point Y coordinate cannot be greater than 5!')
         self.assertGreater(point[0][1], -5,
                            'Point Y coordinate cannot be less than -5!')
     return None
Beispiel #6
0
 def test_value_generator_from_minus_1_to_1(self) -> None:
     self.assertAlmostEqual(0, RandomValueGenerator().rand(), delta=1)
     return None
Beispiel #7
0
 def test_value_generator_from_minus_5_to_5(self) -> None:
     self.assertAlmostEqual(0, RandomValueGenerator(-5, 5).rand(), delta=5)
     return None