22import openml .evaluations
33from openml .testing import TestBase
44
5+
56class TestEvaluationFunctions (TestBase ):
67 _multiprocess_can_split_ = True
78
@@ -15,6 +16,10 @@ def test_evaluation_list_filter_task(self):
1516 self .assertGreater (len (evaluations ), 100 )
1617 for run_id in evaluations .keys ():
1718 self .assertEquals (evaluations [run_id ].task_id , task_id )
19+ # default behaviour of this method: return aggregated results (not
20+ # per fold)
21+ self .assertIsNotNone (evaluations [run_id ].value )
22+ self .assertIsNone (evaluations [run_id ].values )
1823
1924 def test_evaluation_list_filter_uploader_ID_16 (self ):
2025 openml .config .server = self .production_server
@@ -23,7 +28,7 @@ def test_evaluation_list_filter_uploader_ID_16(self):
2328
2429 evaluations = openml .evaluations .list_evaluations ("predictive_accuracy" , uploader = [uploader_id ])
2530
26- self .assertGreater (len (evaluations ), 100 )
31+ self .assertGreater (len (evaluations ), 50 )
2732
2833 def test_evaluation_list_filter_uploader_ID_10 (self ):
2934 openml .config .server = self .production_server
@@ -32,9 +37,13 @@ def test_evaluation_list_filter_uploader_ID_10(self):
3237
3338 evaluations = openml .evaluations .list_evaluations ("predictive_accuracy" , setup = [setup_id ])
3439
35- self .assertGreater (len (evaluations ), 100 )
40+ self .assertGreater (len (evaluations ), 50 )
3641 for run_id in evaluations .keys ():
3742 self .assertEquals (evaluations [run_id ].setup_id , setup_id )
43+ # default behaviour of this method: return aggregated results (not
44+ # per fold)
45+ self .assertIsNotNone (evaluations [run_id ].value )
46+ self .assertIsNone (evaluations [run_id ].values )
3847
3948 def test_evaluation_list_filter_flow (self ):
4049 openml .config .server = self .production_server
@@ -46,17 +55,25 @@ def test_evaluation_list_filter_flow(self):
4655 self .assertGreater (len (evaluations ), 2 )
4756 for run_id in evaluations .keys ():
4857 self .assertEquals (evaluations [run_id ].flow_id , flow_id )
58+ # default behaviour of this method: return aggregated results (not
59+ # per fold)
60+ self .assertIsNotNone (evaluations [run_id ].value )
61+ self .assertIsNone (evaluations [run_id ].values )
4962
5063 def test_evaluation_list_filter_run (self ):
5164 openml .config .server = self .production_server
5265
53- run_id = 1
66+ run_id = 12
5467
5568 evaluations = openml .evaluations .list_evaluations ("predictive_accuracy" , id = [run_id ])
5669
5770 self .assertEquals (len (evaluations ), 1 )
5871 for run_id in evaluations .keys ():
5972 self .assertEquals (evaluations [run_id ].run_id , run_id )
73+ # default behaviour of this method: return aggregated results (not
74+ # per fold)
75+ self .assertIsNotNone (evaluations [run_id ].value )
76+ self .assertIsNone (evaluations [run_id ].values )
6077
6178 def test_evaluation_list_limit (self ):
6279 openml .config .server = self .production_server
@@ -70,3 +87,28 @@ def test_list_evaluations_empty(self):
7087 raise ValueError ('UnitTest Outdated, got somehow results' )
7188
7289 self .assertIsInstance (evaluations , dict )
90+
91+ def test_evaluation_list_per_fold (self ):
92+ openml .config .server = self .production_server
93+ size = 1000
94+ task_ids = [6 ]
95+ uploader_ids = [1 ]
96+ flow_ids = [6969 ]
97+
98+ evaluations = openml .evaluations .list_evaluations (
99+ "predictive_accuracy" , size = size , offset = 0 , task = task_ids ,
100+ flow = flow_ids , uploader = uploader_ids , per_fold = True )
101+
102+ self .assertEquals (len (evaluations ), size )
103+ for run_id in evaluations .keys ():
104+ self .assertIsNone (evaluations [run_id ].value )
105+ self .assertIsNotNone (evaluations [run_id ].values )
106+ # potentially we could also test array values, but these might be
107+ # added in the future
108+
109+ evaluations = openml .evaluations .list_evaluations (
110+ "predictive_accuracy" , size = size , offset = 0 , task = task_ids ,
111+ flow = flow_ids , uploader = uploader_ids , per_fold = False )
112+ for run_id in evaluations .keys ():
113+ self .assertIsNotNone (evaluations [run_id ].value )
114+ self .assertIsNone (evaluations [run_id ].values )
0 commit comments