Serialization
XML serialization for RunEvaluation — the body of the
POST /run/evaluate upload.
Mirrors the XStream annotations on Java's
org.openml.apiconnector.xml.RunEvaluation /
EvaluationScore. Specifically:
* repeat / fold / sample are XML attributes on
<oml:evaluation> (Java marks them @XStreamAsAttribute); the rest
are child elements.
* EvaluationScore.array (a Python list) becomes the comma-joined
oml:array_data string Java expects.
* Fields that are None are omitted entirely (XStream's default for null
fields), so an upload with only function set produces a minimal element.
evaluation_score_to_oml_dict(score)
One <oml:evaluation> element. @repeat / @fold / @sample
are xmltodict attribute keys (the leading @); the remaining fields
are child elements, included only when non-None.
Source code in src/runs/serialization.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
run_evaluation_to_oml_dict(run_eval)
<oml:run_evaluation> envelope. Order of children mirrors
RunEvaluation.java's field declaration order so the output is diff-stable
against the Java serializer.
Source code in src/runs/serialization.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
run_evaluation_to_xml(run_eval, *, pretty=True)
Source code in src/runs/serialization.py
70 71 72 73 74 75 | |