Skip to content

Commit f464a2b

Browse files
authored
Change default size for list_evaluations (#965)
* Change default size for list_evaluations to 10000 * Suggestions from code review
1 parent 9bc84a9 commit f464a2b

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

doc/progress.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Changelog
1919
* MAINT #897: Dropping support for Python 3.5.
2020
* ADD #894: Support caching of datasets using feather format as an option.
2121
* ADD #945: PEP 561 compliance for distributing Type information
22+
* MAINT #371: ``list_evaluations`` default ``size`` changed from ``None`` to ``10_000``.
2223

2324
0.10.2
2425
~~~~~~

examples/40_paper/2018_ida_strang_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
# Downloads all evaluation records related to this study
4949
evaluations = openml.evaluations.list_evaluations(
50-
measure, flows=flow_ids, study=study_id, output_format="dataframe"
50+
measure, size=None, flows=flow_ids, study=study_id, output_format="dataframe"
5151
)
5252
# gives us a table with columns data_id, flow1_value, flow2_value
5353
evaluations = evaluations.pivot(index="data_id", columns="flow_id", values="value").dropna()

openml/evaluations/functions.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def list_evaluations(
1717
function: str,
1818
offset: Optional[int] = None,
19-
size: Optional[int] = None,
19+
size: Optional[int] = 10000,
2020
tasks: Optional[List[Union[str, int]]] = None,
2121
setups: Optional[List[Union[str, int]]] = None,
2222
flows: Optional[List[Union[str, int]]] = None,
@@ -38,8 +38,9 @@ def list_evaluations(
3838
the evaluation function. e.g., predictive_accuracy
3939
offset : int, optional
4040
the number of runs to skip, starting from the first
41-
size : int, optional
42-
the maximum number of runs to show
41+
size : int, default 10000
42+
The maximum number of runs to show.
43+
If set to ``None``, it returns all the results.
4344
4445
tasks : list[int,str], optional
4546
the list of task IDs

tests/test_evaluations/test_evaluation_functions.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def test_evaluation_list_filter_task(self):
4141

4242
task_id = 7312
4343

44-
evaluations = openml.evaluations.list_evaluations("predictive_accuracy", tasks=[task_id])
44+
evaluations = openml.evaluations.list_evaluations(
45+
"predictive_accuracy", size=110, tasks=[task_id]
46+
)
4547

4648
self.assertGreater(len(evaluations), 100)
4749
for run_id in evaluations.keys():
@@ -56,7 +58,7 @@ def test_evaluation_list_filter_uploader_ID_16(self):
5658

5759
uploader_id = 16
5860
evaluations = openml.evaluations.list_evaluations(
59-
"predictive_accuracy", uploaders=[uploader_id], output_format="dataframe"
61+
"predictive_accuracy", size=60, uploaders=[uploader_id], output_format="dataframe"
6062
)
6163
self.assertEqual(evaluations["uploader"].unique(), [uploader_id])
6264

@@ -66,7 +68,9 @@ def test_evaluation_list_filter_uploader_ID_10(self):
6668
openml.config.server = self.production_server
6769

6870
setup_id = 10
69-
evaluations = openml.evaluations.list_evaluations("predictive_accuracy", setups=[setup_id])
71+
evaluations = openml.evaluations.list_evaluations(
72+
"predictive_accuracy", size=60, setups=[setup_id]
73+
)
7074

7175
self.assertGreater(len(evaluations), 50)
7276
for run_id in evaluations.keys():
@@ -81,7 +85,9 @@ def test_evaluation_list_filter_flow(self):
8185

8286
flow_id = 100
8387

84-
evaluations = openml.evaluations.list_evaluations("predictive_accuracy", flows=[flow_id])
88+
evaluations = openml.evaluations.list_evaluations(
89+
"predictive_accuracy", size=10, flows=[flow_id]
90+
)
8591

8692
self.assertGreater(len(evaluations), 2)
8793
for run_id in evaluations.keys():
@@ -96,7 +102,9 @@ def test_evaluation_list_filter_run(self):
96102

97103
run_id = 12
98104

99-
evaluations = openml.evaluations.list_evaluations("predictive_accuracy", runs=[run_id])
105+
evaluations = openml.evaluations.list_evaluations(
106+
"predictive_accuracy", size=2, runs=[run_id]
107+
)
100108

101109
self.assertEqual(len(evaluations), 1)
102110
for run_id in evaluations.keys():
@@ -164,7 +172,7 @@ def test_evaluation_list_sort(self):
164172
task_id = 6
165173
# Get all evaluations of the task
166174
unsorted_eval = openml.evaluations.list_evaluations(
167-
"predictive_accuracy", offset=0, tasks=[task_id]
175+
"predictive_accuracy", size=None, offset=0, tasks=[task_id]
168176
)
169177
# Get top 10 evaluations of the same task
170178
sorted_eval = openml.evaluations.list_evaluations(

tests/test_study/test_study_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def test_publish_study(self):
152152
self.assertSetEqual(set(run_ids), set(study_downloaded.runs))
153153

154154
# test whether the list evaluation function also handles study data fine
155-
run_ids = openml.evaluations.list_evaluations("predictive_accuracy", study=study.id)
155+
run_ids = openml.evaluations.list_evaluations(
156+
"predictive_accuracy", size=None, study=study.id
157+
)
156158
self.assertSetEqual(set(run_ids), set(study_downloaded.runs))
157159

158160
# attach more runs

0 commit comments

Comments
 (0)