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
Parameters#
run_id : int OpenML run id.
dict
Mapping from key (repeat, fold, iteration)
to an object of
OpenMLTraceIteration.
Parameters#
run_id : int Id for which the trace content is to be stored. trace_iterations : List[List] The trace content obtained by running a flow on a task.
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.
Parameters#
attributes : list List of tuples describing the arff attributes.
list
List of lists containing information about the individual tuning runs.
Returns#
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
Parameters#
fold: int
repeat: int
Returns#
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.
Parameters#
cls : type Type of the trace object to be created. traces : List[OpenMLRunTrace] List of traces to merge.
Returns#
OpenMLRunTrace A trace object representing the merged traces.
Raises#
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).
Parameters#
arff_obj : dict LIAC arff obj, dict containing attributes, relation, data.
Returns#
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.
Parameters#
xml : string | file-like object
An xml description that can be either a string
or a file-like
object.
Returns#
run : OpenMLRunTrace Object containing the run id and a dict containing the trace iterations.
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#
arff_dict : dict Dictionary representation of the ARFF file that will be uploaded. Contains information about the optimization trace.
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.
Parameters#
repeat : int repeat number (in case of no repeats: 0)
int
fold number (in case of no folds: 0)
int
iteration number of optimization procedure
str, optional
json string representing the parameters
If not provided, parameters
should be set.
double
The evaluation that was awarded to this trace iteration. Measure is defined by the task
bool
Whether this was the best of all iterations, and hence selected for making predictions. Per fold/repeat there should be only one iteration selected
OrderedDict, optional
Dictionary specifying parameter names and their values.
If not provided, setup_string
should be set.
get_parameters
#
Get the parameters of this trace iteration.