mlflow_tracking

class MLFlowTrackingContext(name: str, experiment: sensai.tracking.mlflow_tracking.MLFlowExperiment, run_id=None, description='')[source]

Bases: sensai.tracking.tracking_base.TrackingContext

__init__(name: str, experiment: sensai.tracking.mlflow_tracking.MLFlowExperiment, run_id=None, description='')
track_figure(name: str, fig: matplotlib.figure.Figure)
Parameters
  • name – the name of the figure (not a filename, should not include file extension)

  • fig – the figure

track_text(name: str, content: str)
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)
class MLFlowExperiment(experiment_name: str, tracking_uri: str, additional_logging_values_dict=None, context_prefix: str = '', add_log_to_all_contexts=False)[source]

Bases: sensai.tracking.tracking_base.TrackedExperiment[sensai.tracking.mlflow_tracking.MLFlowTrackingContext]

__init__(experiment_name: str, tracking_uri: str, additional_logging_values_dict=None, context_prefix: str = '', add_log_to_all_contexts=False)
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 resulting log file to all tracking contexts that are generated for this experiment upon context exit (or process termination if it is not cleanly closed)

begin_context_for_model(model: sensai.vector_model.VectorModelBase)

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: sensai.tracking.mlflow_tracking.MLFlowTrackingContext)