Exemplo n.º 1
0
    def test_make_digits(self):
        data, labels = datasets.load_digits()
        noisy_data, noisy_labels = datasets.make_digits(noise_level=0.3,
                                                        n_samples=1)

        diff = np.abs(data[noisy_labels] - noisy_data).sum()
        self.assertNotEqual(diff, 0)
Exemplo n.º 2
0
    def test_make_digits_flip_mode(self):
        data, labels = datasets.load_digits()
        noisy_data, noisy_labels = datasets.make_digits(
            noise_level=0.5, n_samples=100, mode='flip')

        diff_signs = np.sign(data[noisy_labels] - noisy_data).flatten()
        self.assertEqual({-1, 0, 1}, set(diff_signs))
Exemplo n.º 3
0
    def test_make_digits(self):
        data, labels = datasets.load_digits()
        noisy_data, noisy_labels = datasets.make_digits(noise_level=0.3,
                                                        n_samples=1)

        diff = np.abs(data[noisy_labels] - noisy_data).sum()
        self.assertNotEqual(diff, 0)
Exemplo n.º 4
0
    def test_make_digits_remove_mode(self):
        data, labels = datasets.load_digits()
        noisy_data, noisy_labels = datasets.make_digits(
            noise_level=0.3, n_samples=100, mode='remove')

        diff = data[noisy_labels] - noisy_data
        diff_signs = np.sign(diff).flatten()

        self.assertNotEqual(np.abs(diff).sum(), 0)
        self.assertEqual({0, 1}, set(diff_signs))
Exemplo n.º 5
0
    def test_load_digits(self):
        data, labels = datasets.load_digits()

        self.assertEqual(data.shape, (10, 24))
        self.assertEqual(labels.shape, (10,))
Exemplo n.º 6
0
    def test_load_digits(self):
        data, labels = datasets.load_digits()

        self.assertEqual(data.shape, (10, 24))
        self.assertEqual(labels.shape, (10,))