@@ -412,26 +412,16 @@ def test_initialize_cv_from_run(self):
412412
413413 self .assertEquals (modelS .cv .random_state , 62501 )
414414 self .assertEqual (modelR .cv .random_state , 62501 )
415-
416- def test_get_run_metric_score (self ):
417-
418- # construct sci-kit learn classifier
419- clf = Pipeline (steps = [('imputer' , Imputer (strategy = 'median' )), ('estimator' , RandomForestClassifier ())])
420-
421-
422- # download task
423- task = openml .tasks .get_task (7 )
424-
425- # invoke OpenML run
426- run = openml .runs .run_model_on_task (task , clf )
415+
416+ def _test_local_evaluations (self , run ):
427417
428418 # compare with the scores in user defined measures
429419 accuracy_scores_provided = []
430420 for rep in run .fold_evaluations ['predictive_accuracy' ].keys ():
431421 for fold in run .fold_evaluations ['predictive_accuracy' ][rep ].keys ():
432422 accuracy_scores_provided .append (run .fold_evaluations ['predictive_accuracy' ][rep ][fold ])
433423 accuracy_scores = run .get_metric_score (sklearn .metrics .accuracy_score )
434- self . assertEquals ( sum ( accuracy_scores_provided ), sum ( accuracy_scores ) )
424+ np . testing . assert_array_almost_equal ( accuracy_scores_provided , accuracy_scores )
435425
436426 # also check if we can obtain some other scores: # TODO: how to do AUC?
437427 tests = [(sklearn .metrics .cohen_kappa_score , {'weights' : None }),
@@ -447,6 +437,25 @@ def test_get_run_metric_score(self):
447437 self .assertGreaterEqual (alt_scores [idx ], 0 )
448438 self .assertLessEqual (alt_scores [idx ], 1 )
449439
440+ def test_local_run_metric_score (self ):
441+
442+ # construct sci-kit learn classifier
443+ clf = Pipeline (steps = [('imputer' , Imputer (strategy = 'median' )), ('estimator' , RandomForestClassifier ())])
444+
445+ # download task
446+ task = openml .tasks .get_task (7 )
447+
448+ # invoke OpenML run
449+ run = openml .runs .run_model_on_task (task , clf )
450+
451+ self ._test_local_evaluations (run )
452+
453+ def test_online_run_metric_score (self ):
454+ openml .config .server = self .production_server
455+ run = openml .runs .get_run (5572567 )
456+ self ._test_local_evaluations (run )
457+
458+
450459 def test_initialize_model_from_run (self ):
451460 clf = sklearn .pipeline .Pipeline (steps = [('Imputer' , Imputer (strategy = 'median' )),
452461 ('VarianceThreshold' , VarianceThreshold (threshold = 0.05 )),
0 commit comments