Skip to content

Commit f220098

Browse files
committed
rename did to dataset_id, (and dataset.id to dataset.dataset_id), make all publish methods return self and set the id.
1 parent c936c31 commit f220098

6 files changed

Lines changed: 103 additions & 97 deletions

File tree

examples/OpenMLDemo.ipynb

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"name": "stdout",
119119
"output_type": "stream",
120120
"text": [
121-
"First 10 of 2806 datasets...\n",
121+
"First 10 of 2836 datasets...\n",
122122
" did name NumberOfInstances NumberOfFeatures\n",
123123
"0 1 anneal 898 39\n",
124124
"1 2 anneal 898 39\n",
@@ -274,6 +274,7 @@
274274
" 'creator': 'R.A. Fisher',\n",
275275
" 'data_file': '/home/andy/.openml/cache/datasets/61/dataset.arff',\n",
276276
" 'data_pickle_file': '/home/andy/.openml/cache/datasets/61/dataset.pkl',\n",
277+
" 'dataset_id': 61,\n",
277278
" 'default_target_attribute': 'class',\n",
278279
" 'description': '**Author**: R.A. Fisher \\n'\n",
279280
" '**Source**: '\n",
@@ -304,7 +305,6 @@
304305
" ' -- Iris Versicolour\\n'\n",
305306
" ' -- Iris Virginica',\n",
306307
" 'format': 'ARFF',\n",
307-
" 'id': 61,\n",
308308
" 'ignore_attributes': None,\n",
309309
" 'language': None,\n",
310310
" 'licence': 'Public',\n",
@@ -629,7 +629,6 @@
629629
"name": "stdout",
630630
"output_type": "stream",
631631
"text": [
632-
"2823\n",
633632
"RandomForest has run on the task.\n"
634633
]
635634
}
@@ -651,30 +650,24 @@
651650
},
652651
{
653652
"cell_type": "code",
654-
"execution_count": 17,
653+
"execution_count": 18,
655654
"metadata": {
656655
"collapsed": false
657656
},
658657
"outputs": [
659658
{
660-
"name": "stdout",
661-
"output_type": "stream",
662-
"text": [
663-
"Uploaded run with id 538241\n",
664-
"Check it at www.openml.org/r/538241\n"
665-
]
659+
"data": {
660+
"text/plain": [
661+
"<openml.runs.run.OpenMLRun at 0x7f79c36aa7f0>"
662+
]
663+
},
664+
"execution_count": 18,
665+
"metadata": {},
666+
"output_type": "execute_result"
666667
}
667668
],
668669
"source": [
669-
"import xmltodict\n",
670-
"\n",
671-
"return_code, response = run.publish()\n",
672-
"\n",
673-
"if(return_code == 200):\n",
674-
" response_dict = xmltodict.parse(response)\n",
675-
" run_id = response_dict['oml:upload_run']['oml:run_id']\n",
676-
" print(\"Uploaded run with id %s\" % (run_id))\n",
677-
" print(\"Check it at www.openml.org/r/%s\" % (run_id))"
670+
"run.publish()"
678671
]
679672
},
680673
{

openml/datasets/dataset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class OpenMLDataset(object):
3535
Description of the dataset
3636
FIXME : which of these do we actually nee?
3737
"""
38-
def __init__(self, id=None, name=None, version=None, description=None,
38+
def __init__(self, dataset_id=None, name=None, version=None, description=None,
3939
format=None, creator=None, contributor=None,
4040
collection_date=None, upload_date=None, language=None,
4141
licence=None, url=None, default_target_attribute=None,
@@ -44,7 +44,7 @@ def __init__(self, id=None, name=None, version=None, description=None,
4444
original_data_url=None, paper_url=None, update_comment=None,
4545
md5_checksum=None, data_file=None):
4646
# Attributes received by querying the RESTful API
47-
self.id = int(id) if id is not None else None
47+
self.dataset_id = int(dataset_id) if dataset_id is not None else None
4848
self.name = name
4949
self.version = int(version)
5050
self.description = description
@@ -99,7 +99,7 @@ def __init__(self, id=None, name=None, version=None, description=None,
9999
with open(self.data_pickle_file, "wb") as fh:
100100
pickle.dump((X, categorical, attribute_names), fh, -1)
101101
logger.debug("Saved dataset %d: %s to file %s" %
102-
(self.id, self.name, self.data_pickle_file))
102+
(self.dataset_id, self.name, self.data_pickle_file))
103103

104104
def __eq__(self, other):
105105
if type(other) != OpenMLDataset:

0 commit comments

Comments
 (0)