Manual log

Note

  • Use manual log if,
    • Model framework is not supported for AutoLogging

    • External models where framework not supported for autolog or model built with third party native frameworks in external platforms (Azure, Sagemaker etc.)

class ManualLog(experiment_name=None, set_as_current_exp=None, root_dir=None)

Bases: object

Enables user to trace experiments from external machine learning engines manually.

start_trace(experiment_id: str = None)

Start a tracing session when using manual log option. By default it uses the current experiment used in client initialization.

Parameters:

experiment_id (str) – (Optional) ID of experiment. This will start logging session under specific experiment so runs will be under specific experiment.

A way you might use me is:

>>> client.manual_log.start_trace()
>>> client.manual_log.start_trace(experiment_id="1")
log_metric(key: str, value: float, step: int | None = None) None

Log a metric against active run.

Parameters:
  • key (str) – Metric name.

  • value (float) – Metric value (float).

  • step (int) – Integer training step (iteration) at which was the metric calculated. Defaults to 0.

Returns:

None

A way you might use me is:

>>> client.manual_log.log_metric("mae", .77)
log_metrics(metrics: Dict[str, float], step: int | None = None) None

Log multiple metrics under active run.

Parameters:
  • metrics (dict) – Dictionary of metric_name: String -> value: Float.

  • step (int) – Integer training step (iteration) at which was the metric calculated. Defaults to 0.

Returns:

None

A way you might use me is:

>>> client.manual_log.log_metrics({"mse": 2000.00, "rmse": 50.00})
log_param(key: str, value: Any) None

Log a param against active run.

Parameters:
  • key (str) – Param name.

  • value – Param value.Value is converted to a string.

Returns:

None

A way you might use me is:

>>> client.manual_log.log_param("c", 1)
log_params(params: Dict[str, Any]) None

Log multiple params under active run.

Parameters:

params (dict) – Dictionary of String -> value: (String, but will be string-ified if not)

Returns:

None

A way you might use me is:

>>> client.manual_log.log_params({"n_estimators": 3, "random_state": 42})
set_tag(key: str, value: Any) None

Log tag for active run.

Parameters:
  • key (str) – Param name.

  • value – Param value.Value is converted to a string.

Returns:

None

A way you might use me is:

>>> client.manual_log.set_tag("engineering", "ML Platform")
set_tags(tags: Dict[str, Any]) None

Log multiple tags for active run.

Parameters:

tags (dict) – Dictionary of tags names: String -> value: (String, but will be string-ified if not)

Returns:

None

A way you might use me is:

>>> client.manual_log.set_tags({"engineering": "ML Platform",
"release.candidate": "RC1"})
end_trace()

End a active session.

A way you might use me is:

>>> client.manual_log.end_trace()