Exemple #1
0
 def test_get_split(self):
     split = OpenMLSplit._from_arff_file(self.arff_filename)
     train_split, test_split = split.get(fold=5, repeat=2)
     self.assertEqual(train_split.shape[0], 808)
     self.assertEqual(test_split.shape[0], 90)
     self.assertRaisesRegexp(ValueError, "Repeat 10 not known", split.get,
                             10, 2)
     self.assertRaisesRegexp(ValueError, "Fold 10 not known", split.get, 2,
                             10)
Exemple #2
0
 def test_get_split(self):
     split = OpenMLSplit._from_arff_file(self.arff_filename)
     train_split, test_split = split.get(fold=5, repeat=2)
     self.assertEqual(train_split.shape[0], 808)
     self.assertEqual(test_split.shape[0], 90)
     self.assertRaisesRegexp(ValueError, "Repeat 10 not known",
                             split.get, 10, 2)
     self.assertRaisesRegexp(ValueError, "Fold 10 not known",
                             split.get, 2, 10)
Exemple #3
0
    def test_eq(self):
        split = OpenMLSplit._from_arff_file(self.arff_filename)
        self.assertEqual(split, split)

        split2 = OpenMLSplit._from_arff_file(self.arff_filename)
        split2.name = "a"
        self.assertNotEqual(split, split2)

        split2 = OpenMLSplit._from_arff_file(self.arff_filename)
        split2.description = "a"
        self.assertNotEqual(split, split2)

        split2 = OpenMLSplit._from_arff_file(self.arff_filename)
        split2.split[10] = dict()
        self.assertNotEqual(split, split2)

        split2 = OpenMLSplit._from_arff_file(self.arff_filename)
        split2.split[0][10] = dict()
        self.assertNotEqual(split, split2)
Exemple #4
0
    def test_eq(self):
        split = OpenMLSplit._from_arff_file(self.arff_filename)
        self.assertEqual(split, split)

        split2 = OpenMLSplit._from_arff_file(self.arff_filename)
        split2.name = "a"
        self.assertNotEqual(split, split2)

        split2 = OpenMLSplit._from_arff_file(self.arff_filename)
        split2.description = "a"
        self.assertNotEqual(split, split2)

        split2 = OpenMLSplit._from_arff_file(self.arff_filename)
        split2.split[10] = dict()
        self.assertNotEqual(split, split2)

        split2 = OpenMLSplit._from_arff_file(self.arff_filename)
        split2.split[0][10] = dict()
        self.assertNotEqual(split, split2)
Exemple #5
0
 def test_from_arff_file(self):
     split = OpenMLSplit._from_arff_file(self.arff_filename)
     self.assertIsInstance(split.split, dict)
     self.assertIsInstance(split.split[0], dict)
     self.assertIsInstance(split.split[0][0][0], np.ndarray)
     self.assertIsInstance(split.split[0][0].train, np.ndarray)
     self.assertIsInstance(split.split[0][0].train, np.ndarray)
     self.assertIsInstance(split.split[0][0][1], np.ndarray)
     self.assertIsInstance(split.split[0][0].test, np.ndarray)
     self.assertIsInstance(split.split[0][0].test, np.ndarray)
     for i in range(10):
         for j in range(10):
             self.assertEqual((81,), split.split[i][j].train.shape)
             self.assertEqual((9,), split.split[i][j].test.shape)
Exemple #6
0
 def test_from_arff_file(self):
     split = OpenMLSplit._from_arff_file(self.arff_filename)
     self.assertIsInstance(split.split, dict)
     self.assertIsInstance(split.split[0], dict)
     self.assertIsInstance(split.split[0][0][0], np.ndarray)
     self.assertIsInstance(split.split[0][0].train, np.ndarray)
     self.assertIsInstance(split.split[0][0].train, np.ndarray)
     self.assertIsInstance(split.split[0][0][1], np.ndarray)
     self.assertIsInstance(split.split[0][0].test, np.ndarray)
     self.assertIsInstance(split.split[0][0].test, np.ndarray)
     for i in range(10):
         for j in range(10):
             self.assertGreaterEqual(split.split[i][j].train.shape[0], 808)
             self.assertGreaterEqual(split.split[i][j].test.shape[0], 89)
             self.assertEqual(split.split[i][j].train.shape[0] +
                              split.split[i][j].test.shape[0], 898)
Exemple #7
0
 def test_from_arff_file(self):
     split = OpenMLSplit._from_arff_file(self.arff_filename)
     self.assertIsInstance(split.split, dict)
     self.assertIsInstance(split.split[0], dict)
     self.assertIsInstance(split.split[0][0], dict)
     self.assertIsInstance(split.split[0][0][0][0], np.ndarray)
     self.assertIsInstance(split.split[0][0][0].train, np.ndarray)
     self.assertIsInstance(split.split[0][0][0].train, np.ndarray)
     self.assertIsInstance(split.split[0][0][0][1], np.ndarray)
     self.assertIsInstance(split.split[0][0][0].test, np.ndarray)
     self.assertIsInstance(split.split[0][0][0].test, np.ndarray)
     for i in range(10):
         for j in range(10):
             self.assertGreaterEqual(split.split[i][j][0].train.shape[0], 808)
             self.assertGreaterEqual(split.split[i][j][0].test.shape[0], 89)
             self.assertEqual(split.split[i][j][0].train.shape[0] +
                              split.split[i][j][0].test.shape[0], 898)