Skip to content

Commit ea4c9be

Browse files
authored
Merge pull request #255 from openml/runtests
Runtests
2 parents b4df819 + 03f798c commit ea4c9be

4 files changed

Lines changed: 308 additions & 17 deletions

File tree

openml/runs/functions.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def run_task(task, model, avoid_duplicate_runs=True, flow_tags=None, seed=None):
8080
tags = ['openml-python', run_environment[1]]
8181
# execute the run
8282
run = OpenMLRun(task_id=task.task_id, flow_id=None, dataset_id=dataset.dataset_id, model=model, tags=tags)
83-
run.data_content, run.trace_content, run.trace_attributes = _run_task_get_arffcontent(model, task, class_labels)
83+
res = _run_task_get_arffcontent(model, task, class_labels)
84+
run.data_content, run.trace_content, run.trace_attributes, run.detailed_evaluations = res
8485

8586
if flow_id == False:
8687
# means the flow did not exists. As we could run it, publish it now
@@ -274,6 +275,12 @@ def _prediction_to_row(rep_no, fold_no, row_id, correct_label, predicted_label,
274275
arff_line : list
275276
representation of the current prediction in OpenML format
276277
"""
278+
if not isinstance(rep_no, (int, np.integer)): raise ValueError('rep_no should be int')
279+
if not isinstance(fold_no, (int, np.integer)): raise ValueError('fold_no should be int')
280+
if not isinstance(row_id, (int, np.integer)): raise ValueError('row_id should be int')
281+
if not len(predicted_probabilities) == len(model_classes_mapping):
282+
raise ValueError('len(predicted_probabilities) != len(class_labels)')
283+
277284
arff_line = [rep_no, fold_no, row_id]
278285
for class_label_idx in range(len(class_labels)):
279286
if class_label_idx in model_classes_mapping:
@@ -366,7 +373,7 @@ def _run_task_get_arffcontent(model, task, class_labels):
366373
else:
367374
arff_tracecontent = None
368375
arff_trace_attributes = None
369-
return arff_datacontent, arff_tracecontent, arff_trace_attributes
376+
return arff_datacontent, arff_tracecontent, arff_trace_attributes, user_defined_measures
370377

371378

372379
def _extract_arfftrace(model, rep_no, fold_no):

tests/test_flows/test_sklearn.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ def test_gaussian_process(self):
461461
sklearn_to_flow, gp)
462462

463463
def test_error_on_adding_component_multiple_times_to_flow(self):
464+
# this function implicitly checks
465+
# - openml.flows._check_multiple_occurence_of_component_in_flow()
464466
pca = sklearn.decomposition.PCA()
465467
pca2 = sklearn.decomposition.PCA()
466468
pipeline = sklearn.pipeline.Pipeline((('pca1', pca), ('pca2', pca2)))

0 commit comments

Comments
 (0)