MLFlowLogger#

class braintools.trainer.MLFlowLogger(experiment_name, tracking_uri=None, run_name=None, tags=None, save_dir=None, **kwargs)#

MLflow logging backend.

Parameters:
  • experiment_name (str) – MLflow experiment name.

  • tracking_uri (str | None) – MLflow tracking server URI.

  • run_name (str | None) – Run name.

  • tags (Dict[str, str] | None) – Tags for the run.

  • save_dir (str | None) – Local directory for MLflow artifacts.

Examples

>>> logger = MLFlowLogger(experiment_name='my_experiment')
>>> trainer = Trainer(logger=logger)
finalize(status='success')[source]#

Finalize logging (called at end of training).

Parameters:

status (str) – Final status (‘success’, ‘failed’, ‘interrupted’).

log_artifact(local_path, artifact_path=None)[source]#

Log an artifact (file).

Parameters:
  • local_path (str) – Path to the local file.

  • artifact_path (str | None) – Path in artifact storage.

log_hyperparams(params)[source]#

Log hyperparameters.

Parameters:

params (Dict[str, Any]) – Dictionary of hyperparameter names to values.

log_metrics(metrics, step=None)[source]#

Log metrics.

Parameters:
  • metrics (Dict[str, float]) – Dictionary of metric names to values.

  • step (int | None) – Global step number.

save()[source]#

Save/flush any buffered data.