@@ -81,20 +81,20 @@ def get_estimation_procedure_list():
8181 return procs
8282
8383
84- def list_tasks (task_type_id = 1 ):
85- """Return a list of all tasks which are on OpenML.
84+ def list_tasks_by_type (task_type_id ):
85+ """Return a list of all tasks for a given tasks type which are on OpenML.
8686
8787 Parameters
8888 ----------
8989 task_type_id : int
9090 ID of the task type as detailed
91- `here <http://openml.org/api/?f=openml.task.types >`_.
91+ `here <http://www. openml.org/search?type=task_type >`_.
9292
9393 Returns
9494 -------
95- tasks : list
96- A list of all tasks. Every task is represented by a
97- dictionary containing the following information: task id,
95+ list
96+ A list of all tasks of the given task type . Every task is represented by
97+ a dictionary containing the following information: task id,
9898 dataset id, task_type and status. If qualities are calculated for
9999 the associated dataset, some of these are also returned.
100100 """
@@ -103,9 +103,25 @@ def list_tasks(task_type_id=1):
103103 except :
104104 raise ValueError ("Task Type ID is neither an Integer nor can be "
105105 "cast to an Integer." )
106+ return _list_tasks ("task/list/type/%d" % task_type_id )
106107
107- return_code , xml_string = _perform_api_call (
108- "task/list/type/%d" % task_type_id )
108+
109+ def list_tasks ():
110+ """Return a list of all tasks which are on OpenML.
111+
112+ Returns
113+ -------
114+ list
115+ A list of all tasks. Every task is represented by a
116+ dictionary containing the following information: task id,
117+ dataset id, task_type and status. If qualities are calculated for
118+ the associated dataset, some of these are also returned.
119+ """
120+ return _list_tasks ('task/list' )
121+
122+
123+ def _list_tasks (api_call ):
124+ return_code , xml_string = _perform_api_call (api_call )
109125 tasks_dict = xmltodict .parse (xml_string )
110126 # Minimalistic check if the XML is useful
111127 assert tasks_dict ['oml:tasks' ]['@xmlns:oml' ] == \
@@ -127,7 +143,8 @@ def list_tasks(task_type_id=1):
127143 if input ['@name' ] == 'estimation_procedure' :
128144 task [input ['@name' ]] = proc_dict [int (input ['#text' ])]['name' ]
129145 else :
130- task [input ['@name' ]] = input ['#text' ]
146+ value = input .get ('#text' )
147+ task [input ['@name' ]] = value
131148
132149 task [input ['@name' ]] = input ['#text' ]
133150
0 commit comments