def test_labels(self):
        x = np.arange(12).reshape((4, 3))
        y = np.arange(8).reshape((4, 2))

        ga = GaussianAugmentation()
        new_x, new_y = ga(x, y)
        self.assertTrue(new_x.shape[0] == new_y.shape[0] == 8)
        self.assertTrue(new_x.shape[1:] == x.shape[1:])
        self.assertTrue(new_y.shape[1:] == y.shape[1:])
Esempio n. 2
0
    def test_labels(self):
        x = np.arange(12).reshape((4, 3))
        y = np.arange(8).reshape((4, 2))

        ga = GaussianAugmentation()
        x_new, new_y = ga(x, y)
        self.assertTrue(x_new.shape[0] == new_y.shape[0] == 8)
        self.assertEqual(x_new.shape[1:], x.shape[1:])
        self.assertEqual(new_y.shape[1:], y.shape[1:])
Esempio n. 3
0
    def test_failure_augmentation_fit_predict(self):
        # Assert that value error is raised
        with self.assertRaises(ValueError) as context:
            _ = GaussianAugmentation(augmentation=True,
                                     apply_fit=True,
                                     apply_predict=True)

        self.assertTrue(
            'If `augmentation` is `True`, then `apply_fit` must be `True` and `apply_predict`'
            ' must be `False`.' in str(context.exception))

        if __name__ == '__main__':
            unittest.main()
 def test_no_augmentation(self):
     x = np.arange(12).reshape((4, 3))
     ga = GaussianAugmentation(augmentation=False)
     new_x, _ = ga(x)
     self.assertTrue(x.shape == new_x.shape)
     self.assertFalse((x == new_x).all())
 def test_multiple_size(self):
     x = np.arange(12).reshape((4, 3))
     ga = GaussianAugmentation(ratio=3.5)
     new_x, _ = ga(x)
     self.assertTrue(int(4.5 * x.shape[0]) == new_x.shape[0])
 def test_double_size(self):
     x = np.arange(12).reshape((4, 3))
     ga = GaussianAugmentation()
     new_x, _ = ga(x)
     self.assertTrue(new_x.shape[0] == 2 * x.shape[0])
 def test_small_size(self):
     x = np.arange(15).reshape((5, 3))
     ga = GaussianAugmentation(ratio=0.4)
     new_x, _ = ga(x)
     self.assertTrue(new_x.shape == (7, 3))
Esempio n. 8
0
 def test_no_augmentation(self):
     x = np.arange(12).reshape((4, 3))
     ga = GaussianAugmentation(augmentation=False)
     x_new, _ = ga(x)
     self.assertEqual(x.shape, x_new.shape)
     self.assertFalse((x == x_new).all())
Esempio n. 9
0
 def test_multiple_size(self):
     x = np.arange(12).reshape((4, 3))
     ga = GaussianAugmentation(ratio=3.5)
     x_new, _ = ga(x)
     self.assertEqual(int(4.5 * x.shape[0]), x_new.shape[0])
Esempio n. 10
0
 def test_double_size(self):
     x = np.arange(12).reshape((4, 3))
     ga = GaussianAugmentation()
     x_new, _ = ga(x)
     self.assertEqual(x_new.shape[0], 2 * x.shape[0])
Esempio n. 11
0
 def test_small_size(self):
     x = np.arange(15).reshape((5, 3))
     ga = GaussianAugmentation(ratio=0.4)
     x_new, _ = ga(x)
     self.assertEqual(x_new.shape, (7, 3))