Пример #1
0
 def test_prepare_data(self):
     """ Test _prepare_data method on numpy array data """
     dc = DatasetClient(self.project.hid)
     samples = 100
     columns = 10
     X = np.random.rand(samples, columns)
     y = np.random.choice([0, 1], samples, replace=True)
     data, data_hash = dc._prepare_data(X, y)
     self.assertTrue(data is not None)
     self.assertTrue(data_hash is not None)
     self.assertTrue(isinstance(data_hash, str))
     self.assertEqual(11, len(data.columns))
     self.assertTrue('target' in data.columns)
     self.assertTrue('attribute_1' in data.columns)
     self.assertTrue('attribute_10' in data.columns)
Пример #2
0
 def test_prepare_data_two_sources_numpy(self):
     dc = DatasetClient(self.project.hid)
     data_1, data_hash_1 = dc._prepare_data(np.array(self.X),
                                            np.array(self.y))
     data_2, data_hash_2 = dc._prepare_data(np.array(self.X), None)
     self.assertNotEqual(data_hash_1, data_hash_2)
Пример #3
0
 def test_prepare_data_two_sources(self):
     dc = DatasetClient(self.project.hid)
     data_1, data_hash_1 = dc._prepare_data(self.X, self.y)
     data_2, data_hash_2 = dc._prepare_data(self.X, None)
     self.assertNotEqual(data_hash_1, data_hash_2)