def test_data_status(self): dataset = OpenMLDataset( "%s-UploadTestWithURL" % self._get_sentinel(), "test", "ARFF", version=1, url="https://www.openml.org/data/download/61/dataset_61_iris.arff") dataset.publish() did = dataset.dataset_id # admin key for test server (only adminds can activate datasets. # all users can deactivate their own datasets) openml.config.apikey = 'd488d8afd93b32331cf6ea9d7003d4c3' openml.datasets.status_update(did, 'active') # need to use listing fn, as this is immune to cache result = openml.datasets.list_datasets(data_id=did, status='all') self.assertEqual(len(result), 1) self.assertEqual(result[did]['status'], 'active') openml.datasets.status_update(did, 'deactivated') # need to use listing fn, as this is immune to cache result = openml.datasets.list_datasets(data_id=did, status='all') self.assertEqual(len(result), 1) self.assertEqual(result[did]['status'], 'deactivated') openml.datasets.status_update(did, 'active') # need to use listing fn, as this is immune to cache result = openml.datasets.list_datasets(data_id=did, status='all') self.assertEqual(len(result), 1) self.assertEqual(result[did]['status'], 'active') with self.assertRaises(ValueError): openml.datasets.status_update(did, 'in_preparation') # need to use listing fn, as this is immune to cache result = openml.datasets.list_datasets(data_id=did, status='all') self.assertEqual(len(result), 1) self.assertEqual(result[did]['status'], 'active')
def test_upload_dataset_with_url(self): dataset = OpenMLDataset( name="UploadTestWithURL", version=1, description="test", format="ARFF", url="https://www.openml.org/data/download/61/dataset_61_iris.arff") dataset.publish() self.assertIsInstance(dataset.dataset_id, int)
def test_upload_dataset_with_url(self): dataset = OpenMLDataset( name="UploadTestWithURL", version=1, description="test", format="ARFF", url="http://expdb.cs.kuleuven.be/expdb/data/uci/nominal/iris.arff") dataset.publish() self.assertIsInstance(dataset.dataset_id, int)
def test_upload_dataset_with_url(self): dataset = OpenMLDataset( name="UploadTestWithURL", version=1, description="test", format="ARFF", url="http://www.cs.umb.edu/~rickb/files/UCI/anneal.arff") dataset.publish() self.assertIsInstance(dataset.dataset_id, int)
def test_publish_dataset(self): dataset = openml.datasets.get_dataset(3) file_path = os.path.join(openml.config.get_cache_directory(), "datasets", "3", "dataset.arff") dataset = OpenMLDataset( name="anneal", version=1, description="test", format="ARFF", licence="public", default_target_attribute="class", data_file=file_path) dataset.publish() self.assertIsInstance(dataset.dataset_id, int)
def test_upload_dataset_with_url(self): dataset = OpenMLDataset( "%s-UploadTestWithURL" % self._get_sentinel(), "test", data_format="arff", version=1, url="https://www.openml.org/data/download/61/dataset_61_iris.arff", ) dataset.publish() self.assertIsInstance(dataset.dataset_id, int)
def test_publish_dataset(self): # lazy loading not possible as we need the arff-file. openml.datasets.get_dataset(3) file_path = os.path.join(openml.config.get_cache_directory(), "datasets", "3", "dataset.arff") dataset = OpenMLDataset( "anneal", "test", data_format="arff", version=1, licence="public", default_target_attribute="class", data_file=file_path, ) dataset.publish() self.assertIsInstance(dataset.dataset_id, int)
def test_upload_dataset_with_url(self): dataset = OpenMLDataset( name="UploadTestWithURL", version=1, description="test", format="ARFF", url="http://expdb.cs.kuleuven.be/expdb/data/uci/nominal/iris.arff") return_code, return_value = dataset.publish() # self.assertTrue("This is a read-only account" in return_value) self.assertEqual(return_code, 200)
def test_publish_dataset(self): dataset = openml.datasets.get_dataset(3) file_path = os.path.join(openml.config.get_cache_directory(), "datasets", "3", "dataset.arff") dataset = OpenMLDataset( name="anneal", version=1, description="test", format="ARFF", licence="public", default_target_attribute="class", data_file=file_path) return_code, return_value = dataset.publish() # self.assertTrue("This is a read-only account" in return_value) self.assertEqual(return_code, 200)