Skip to content

Commit 6853392

Browse files
committed
do not propagate error messages to openml server
1 parent 1abf093 commit 6853392

2 files changed

Lines changed: 8 additions & 19 deletions

File tree

openml/runs/functions.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,7 @@ def run_task(task, model):
5353

5454
# execute the run
5555
run = OpenMLRun(task_id=task.task_id, flow_id=None, dataset_id=dataset.dataset_id, model=model)
56-
57-
try:
58-
run.data_content, run.trace_content = _run_task_get_arffcontent(model, task, class_labels)
59-
except PyOpenMLError as message:
60-
run.error_message = str(message)
61-
warnings.warn("Run terminated with error: %s" %run.error_message)
56+
run.data_content, run.trace_content = _run_task_get_arffcontent(model, task, class_labels)
6257

6358
# now generate the flow
6459
flow = sklearn_to_flow(model)
@@ -131,17 +126,13 @@ def _run_task_get_arffcontent(model, task, class_labels):
131126
testX = X[test_indices]
132127
testY = Y[test_indices]
133128

134-
try:
135-
model.fit(trainX, trainY)
136-
137-
if isinstance(model, BaseSearchCV):
138-
_add_results_to_arfftrace(arff_tracecontent, fold_no, model, rep_no)
139-
model_classes = model.best_estimator_.classes_
140-
else:
141-
model_classes = model.classes_
142-
except AttributeError as e:
143-
# typically happens when training a regressor on classification task
144-
raise PyOpenMLError(str(e))
129+
model.fit(trainX, trainY)
130+
131+
if isinstance(model, BaseSearchCV):
132+
_add_results_to_arfftrace(arff_tracecontent, fold_no, model, rep_no)
133+
model_classes = model.best_estimator_.classes_
134+
else:
135+
model_classes = model.classes_
145136

146137
ProbaY = model.predict_proba(testX)
147138
PredY = model.predict(testX)

tests/test_runs/test_run_functions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ def test__run_task_get_arffcontent(self):
136136
# 10 times 10 fold CV of 150 samples
137137
self.assertEqual(len(arff_datacontent), num_instances * num_repeats)
138138
for arff_line in arff_datacontent:
139-
print(arff_line)
140139
# check number columns
141140
self.assertEqual(len(arff_line), 7)
142141
# check repeat
@@ -298,7 +297,6 @@ def test_run_on_dataset_with_missing_labels(self):
298297
# 2 folds, 5 repeats; keep in mind that this task comes from the test
299298
# server, the task on the live server is different
300299
self.assertEqual(len(data_content), 4490)
301-
print(data_content[0])
302300
for row in data_content:
303301
# repeat, fold, row_id, 6 confidences, prediction and correct label
304302
self.assertEqual(len(row), 11)

0 commit comments

Comments
 (0)