Skip to content

Commit c80c295

Browse files
committed
fixed code for arxiv paper
1 parent 75b04cf commit c80c295

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

openml/study/functions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ def _multitag_to_list(result_dict, tag):
1212
raise TypeError()
1313

1414

15-
def get_study(study_id):
15+
def get_study(study_id, type=None):
1616
'''
1717
Retrieves all relevant information of an OpenML study from the server
1818
Note that some of the (data, tasks, flows, setups) fields can be empty
1919
(depending on information on the server)
2020
'''
21-
xml_string = _perform_api_call("study/%s" %str(study_id))
21+
call_suffix = "study/%s" %str(study_id)
22+
if type is not None:
23+
call_suffix += "/" + type
24+
xml_string = _perform_api_call(call_suffix)
2225
result_dict = xmltodict.parse(xml_string)['oml:study']
2326
id = int(result_dict['oml:id'])
2427
name = result_dict['oml:name']

tests/test_study/test_study_functions.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,13 @@ def test_get_study(self):
1313
self.assertEquals(len(study.data), 105)
1414
self.assertEquals(len(study.tasks), 105)
1515
self.assertEquals(len(study.flows), 27)
16-
self.assertEquals(len(study.setups), 30)
16+
self.assertEquals(len(study.setups), 30)
17+
18+
def test_get_tasks(self):
19+
study_id = 14
20+
21+
study = openml.study.get_study(study_id, 'tasks')
22+
self.assertEquals(study.data, None)
23+
self.assertGreater(len(study.tasks), 0)
24+
self.assertEquals(study.flows, None)
25+
self.assertEquals(study.setups, None)

0 commit comments

Comments
 (0)