trace
openml.runs.trace
#
OpenMLRunTrace
#
OpenMLRunTrace(run_id: int | None, trace_iterations: dict[tuple[int, int, int], OpenMLTraceIteration])
OpenML Run Trace: parsed output from Run Trace call
| PARAMETER | DESCRIPTION |
|---|---|
run_id
|
OpenML run id.
TYPE:
|
trace_iterations
|
Mapping from key
TYPE:
|
| PARAMETER | DESCRIPTION |
|---|---|
run_id
|
Id for which the trace content is to be stored.
TYPE:
|
trace_iterations
|
The trace content obtained by running a flow on a task.
TYPE:
|
Source code in openml/runs/trace.py
generate
classmethod
#
generate(attributes: list[tuple[str, str]], content: list[list[int | float | str]]) -> OpenMLRunTrace
Generates an OpenMLRunTrace.
Generates the trace object from the attributes and content extracted while running the underlying flow.
| PARAMETER | DESCRIPTION |
|---|---|
attributes
|
List of tuples describing the arff attributes.
TYPE:
|
content
|
List of lists containing information about the individual tuning runs.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
OpenMLRunTrace
|
|
Source code in openml/runs/trace.py
get_selected_iteration
#
Returns the trace iteration that was marked as selected. In case multiple are marked as selected (should not happen) the first of these is returned
| PARAMETER | DESCRIPTION |
|---|---|
fold
|
TYPE:
|
repeat
|
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
The trace iteration from the given fold and repeat that was selected as the best iteration by the search procedure |
Source code in openml/runs/trace.py
merge_traces
classmethod
#
merge_traces(traces: list[OpenMLRunTrace]) -> OpenMLRunTrace
Merge multiple traces into a single trace.
| PARAMETER | DESCRIPTION |
|---|---|
cls
|
Type of the trace object to be created.
TYPE:
|
traces
|
List of traces to merge.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
OpenMLRunTrace
|
A trace object representing the merged traces. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the parameters in the iterations of the traces being merged are not equal. If a key (repeat, fold, iteration) is encountered twice while merging the traces. |
Source code in openml/runs/trace.py
trace_from_arff
classmethod
#
trace_from_arff(arff_obj: dict[str, Any]) -> OpenMLRunTrace
Generate trace from arff trace.
Creates a trace file from arff object (for example, generated by a local run).
| PARAMETER | DESCRIPTION |
|---|---|
arff_obj
|
LIAC arff obj, dict containing attributes, relation, data.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
OpenMLRunTrace
|
|
Source code in openml/runs/trace.py
trace_from_xml
classmethod
#
trace_from_xml(xml: str | Path | IO) -> OpenMLRunTrace
Generate trace from xml.
Creates a trace file from the xml description.
| PARAMETER | DESCRIPTION |
|---|---|
xml
|
An xml description that can be either a
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
run
|
Object containing the run id and a dict containing the trace iterations.
TYPE:
|
Source code in openml/runs/trace.py
trace_to_arff
#
Generate the arff dictionary for uploading predictions to the server.
Uses the trace object to generate an arff dictionary representation.
| RETURNS | DESCRIPTION |
|---|---|
arff_dict
|
Dictionary representation of the ARFF file that will be uploaded. Contains information about the optimization trace.
TYPE:
|
Source code in openml/runs/trace.py
OpenMLTraceIteration
dataclass
#
OpenMLTraceIteration(repeat: int, fold: int, iteration: int, evaluation: float, selected: bool, setup_string: dict[str, str] | None = None, parameters: dict[str, str | int | float] | None = None)
OpenML Trace Iteration: parsed output from Run Trace call
Exactly one of setup_string or parameters must be provided.
| PARAMETER | DESCRIPTION |
|---|---|
repeat
|
repeat number (in case of no repeats: 0)
TYPE:
|
fold
|
fold number (in case of no folds: 0)
TYPE:
|
iteration
|
iteration number of optimization procedure
TYPE:
|
setup_string
|
json string representing the parameters
If not provided,
TYPE:
|
evaluation
|
The evaluation that was awarded to this trace iteration. Measure is defined by the task
TYPE:
|
selected
|
Whether this was the best of all iterations, and hence selected for making predictions. Per fold/repeat there should be only one iteration selected
TYPE:
|
parameters
|
Dictionary specifying parameter names and their values.
If not provided,
TYPE:
|
get_parameters
#
Get the parameters of this trace iteration.