@@ -31,7 +31,7 @@ def _perform_run(self, task_id, num_instances, clf):
3131 return run
3232
3333 def test_run_regression_on_classif_task (self ):
34- task_id = 10107
34+ task_id = 115
3535
3636 clf = LinearRegression ()
3737 task = openml .tasks .get_task (task_id )
@@ -43,7 +43,7 @@ def test_run_regression_on_classif_task(self):
4343
4444 @mock .patch ('openml.flows.sklearn_to_flow' )
4545 def test_check_erronous_sklearn_flow_fails (self , sklearn_to_flow_mock ):
46- task_id = 10107
46+ task_id = 115
4747 task = openml .tasks .get_task (task_id )
4848
4949 # Invalid parameter values
@@ -52,16 +52,16 @@ def test_check_erronous_sklearn_flow_fails(self, sklearn_to_flow_mock):
5252 self .assertRaisesRegexp (ValueError , "Penalty term must be positive; got \(C='abc'\)" ,
5353 openml .runs .run_task , task = task , model = clf )
5454
55- def test_run_iris (self ):
56- task_id = 10107
57- num_instances = 150
55+ def test_run_diabetes (self ):
56+ task_id = 115
57+ num_instances = 768
5858
5959 clf = LogisticRegression ()
6060 self ._perform_run (task_id ,num_instances , clf )
6161
6262 def test_run_optimize_randomforest_iris (self ):
63- task_id = 10107
64- num_instances = 150
63+ task_id = 115
64+ num_instances = 768
6565 num_folds = 10
6666 num_iterations = 5
6767
@@ -80,8 +80,8 @@ def test_run_optimize_randomforest_iris(self):
8080 self .assertEqual (len (run .trace_content ), num_iterations * num_folds )
8181
8282 def test_run_optimize_bagging_iris (self ):
83- task_id = 10107
84- num_instances = 150
83+ task_id = 115
84+ num_instances = 768
8585 num_folds = 10
8686 num_iterations = 9 # (num values for C times gamma)
8787
@@ -94,8 +94,8 @@ def test_run_optimize_bagging_iris(self):
9494 self .assertEqual (len (run .trace_content ), num_iterations * num_folds )
9595
9696 def test_run_pipeline (self ):
97- task_id = 10107
98- num_instances = 150
97+ task_id = 115
98+ num_instances = 768
9999 num_folds = 10
100100 num_iterations = 9 # (num values for C times gamma)
101101
@@ -107,8 +107,11 @@ def test_run_pipeline(self):
107107 self .assertEqual (run .trace_content , None )
108108
109109 def test__run_task_get_arffcontent (self ):
110- task = openml .tasks .get_task (1939 )
110+ task = openml .tasks .get_task (7 )
111111 class_labels = task .class_labels
112+ num_instances = 3196
113+ num_folds = 10
114+ num_repeats = 1
112115
113116 clf = SGDClassifier (loss = 'hinge' , random_state = 1 )
114117 self .assertRaisesRegexp (AttributeError ,
@@ -125,20 +128,24 @@ def test__run_task_get_arffcontent(self):
125128 self .assertIsInstance (arff_tracecontent , type (None ))
126129
127130 # 10 times 10 fold CV of 150 samples
128- self .assertEqual (len (arff_datacontent ), 1500 )
131+ self .assertEqual (len (arff_datacontent ), num_instances * num_repeats )
129132 for arff_line in arff_datacontent :
130- self .assertEqual (len (arff_line ), 8 )
133+ print (arff_line )
134+ # check number columns
135+ self .assertEqual (len (arff_line ), 7 )
136+ # check repeat
131137 self .assertGreaterEqual (arff_line [0 ], 0 )
132- self .assertLessEqual (arff_line [0 ], 9 )
138+ self .assertLessEqual (arff_line [0 ], num_repeats - 1 )
139+ # check fold
133140 self .assertGreaterEqual (arff_line [1 ], 0 )
134- self .assertLessEqual (arff_line [1 ], 9 )
141+ self .assertLessEqual (arff_line [1 ], num_folds - 1 )
142+ # check row id
135143 self .assertGreaterEqual (arff_line [2 ], 0 )
136- self .assertLessEqual (arff_line [2 ], 149 )
137- self .assertAlmostEqual (sum (arff_line [3 :6 ]), 1.0 )
138- self .assertIn (arff_line [6 ], ['Iris-setosa' , 'Iris-versicolor' ,
139- 'Iris-virginica' ])
140- self .assertIn (arff_line [7 ], ['Iris-setosa' , 'Iris-versicolor' ,
141- 'Iris-virginica' ])
144+ self .assertLessEqual (arff_line [2 ], num_instances - 1 )
145+ # check confidences
146+ self .assertAlmostEqual (sum (arff_line [3 :5 ]), 1.0 )
147+ self .assertIn (arff_line [5 ], ['won' , 'nowin' ])
148+ self .assertIn (arff_line [6 ], ['won' , 'nowin' ])
142149
143150 def test_get_run (self ):
144151 # this run is not available on test
@@ -163,12 +170,16 @@ def _check_run(self, run):
163170 self .assertEqual (len (run ), 5 )
164171
165172 def test_get_runs_list (self ):
173+ # TODO: comes from live, no such lists on test
174+ openml .config .server = self .production_server
166175 runs = openml .runs .list_runs (id = [2 ])
167176 self .assertEqual (len (runs ), 1 )
168177 for rid in runs :
169178 self ._check_run (runs [rid ])
170179
171180 def test_get_runs_list_by_task (self ):
181+ # TODO: comes from live, no such lists on test
182+ openml .config .server = self .production_server
172183 task_ids = [20 ]
173184 runs = openml .runs .list_runs (task = task_ids )
174185 self .assertGreaterEqual (len (runs ), 590 )
@@ -185,6 +196,8 @@ def test_get_runs_list_by_task(self):
185196 self ._check_run (runs [rid ])
186197
187198 def test_get_runs_list_by_uploader (self ):
199+ # TODO: comes from live, no such lists on test
200+ openml .config .server = self .production_server
188201 # 29 is Dominik Kirchhoff - Joaquin and Jan have too many runs right now
189202 uploader_ids = [29 ]
190203
@@ -204,6 +217,8 @@ def test_get_runs_list_by_uploader(self):
204217 self ._check_run (runs [rid ])
205218
206219 def test_get_runs_list_by_flow (self ):
220+ # TODO: comes from live, no such lists on test
221+ openml .config .server = self .production_server
207222 flow_ids = [1154 ]
208223 runs = openml .runs .list_runs (flow = flow_ids )
209224 self .assertGreaterEqual (len (runs ), 1 )
@@ -220,6 +235,8 @@ def test_get_runs_list_by_flow(self):
220235 self ._check_run (runs [rid ])
221236
222237 def test_get_runs_pagination (self ):
238+ # TODO: comes from live, no such lists on test
239+ openml .config .server = self .production_server
223240 uploader_ids = [1 ]
224241 size = 10
225242 max = 100
@@ -230,9 +247,11 @@ def test_get_runs_pagination(self):
230247 self .assertIn (runs [rid ]["uploader" ], uploader_ids )
231248
232249 def test_get_runs_list_by_filters (self ):
250+ # TODO: comes from live, no such lists on test
251+ openml .config .server = self .production_server
233252 ids = [505212 , 6100 ]
234253 tasks = [2974 , 339 ]
235- uploaders_1 = [1 , 17 ]
254+ uploaders_1 = [1 , 2 ]
236255 uploaders_2 = [29 , 274 ]
237256 flows = [74 , 1718 ]
238257
@@ -253,6 +272,8 @@ def test_get_runs_list_by_filters(self):
253272 runs = openml .runs .list_runs (id = ids , task = tasks , uploader = uploaders_1 )
254273
255274 def test_get_runs_list_by_tag (self ):
275+ # TODO: comes from live, no such lists on test
276+ openml .config .server = self .production_server
256277 runs = openml .runs .list_runs (tag = 'curves' )
257278 self .assertGreaterEqual (len (runs ), 1 )
258279
0 commit comments