mlflow_tracking#


class MLFlowTrackingContext(name: str, experiment: MLFlowExperiment, run_id=None, description='')[source]#

Bases: TrackingContext

track_figure(name: str, fig: Figure)[source]#
Parameters:
  • name – the name of the figure (not a filename, should not include file extension)

  • fig – the figure

track_text(name: str, content: str)[source]#
Parameters:
  • name – the name of the text (not a filename, should not include file extension)

  • content – the content (arbitrarily long text, e.g. a log)

track_tag(tag_name: str, tag_value: str)[source]#
class MLFlowExperiment(experiment_name: str, tracking_uri: str, additional_logging_values_dict=None, context_prefix: str = '', add_log_to_all_contexts=False)[source]#

Bases: TrackedExperiment[MLFlowTrackingContext]

Parameters:
  • experiment_name – the name of the experiment, which should be the same for all models of the same kind (i.e. all models evaluated under the same conditions)

  • tracking_uri – the URI of the server (if any); use “” to track in the local file system

  • additional_logging_values_dict

  • context_prefix – a prefix to add to all contexts that are created within the experiment. This can be used to add an identifier of a certain execution/run, such that the actual context name passed to begin_context can be concise (e.g. just model name).

  • add_log_to_all_contexts – whether to enable in-memory logging and add the respective log to each context

begin_context_for_model(model: VectorModelBase)[source]#

Begins a tracking context for the case where we want to track information about a model (wrapper around begin_context for convenience). The model name is used as the context name, and the model’s string representation is used as the description. The returned object is a context manager, which can be used in a with-statement.

Parameters:

model – the model

Returns:

the context, which can subsequently be used to track information

end_context(instance: MLFlowTrackingContext)[source]#