Skip to content

Commit dcac17e

Browse files
amuellermfeurer
authored andcommitted
store predictions_url in runs (#783)
* store predictions_url in runs * can't test when uploading a new run as we don't have details locally * Fix PEP8
1 parent fe218bc commit dcac17e

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

openml/runs/functions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,10 +687,13 @@ def obtain_field(xml_obj, fieldname, from_server, cast=None):
687687
'(OpenML server error?)')
688688
else:
689689
output_data = run['oml:output_data']
690+
predictions_url = None
690691
if 'oml:file' in output_data:
691692
# multiple files, the normal case
692693
for file_dict in output_data['oml:file']:
693694
files[file_dict['oml:name']] = int(file_dict['oml:file_id'])
695+
if file_dict['oml:name'] == 'predictions':
696+
predictions_url = file_dict['oml:url']
694697
if 'oml:evaluation' in output_data:
695698
# in normal cases there should be evaluations, but in case there
696699
# was an error these could be absent
@@ -757,8 +760,8 @@ def obtain_field(xml_obj, fieldname, from_server, cast=None):
757760
dataset_id=dataset_id, output_files=files,
758761
evaluations=evaluations,
759762
fold_evaluations=fold_evaluations,
760-
sample_evaluations=sample_evaluations,
761-
tags=tags)
763+
sample_evaluations=sample_evaluations, tags=tags,
764+
predictions_url=predictions_url)
762765

763766

764767
def _get_cached_run(run_id):

tests/test_runs/test_run_functions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,12 @@ def test_get_run(self):
11121112
self.assertEqual(run.fold_evaluations['f_measure'][0][i], value)
11131113
assert ('weka' in run.tags)
11141114
assert ('weka_3.7.12' in run.tags)
1115+
assert (
1116+
run.predictions_url == (
1117+
"https://www.openml.org/data/download/1667125/"
1118+
"weka_generated_predictions4575715871712251329.arff"
1119+
)
1120+
)
11151121

11161122
def _check_run(self, run):
11171123
self.assertIsInstance(run, dict)

0 commit comments

Comments
 (0)