Track metrics and metadata

Tracking metrics and metadata

ZenML provides a unified way to log and manage metrics and metadata through the log_metadata function. This versatile function allows you to log metadata across various entities like models, artifacts, steps, and runs through a single interface. Additionally, you can adjust if you want to automatically the same metadata for the related entities.

The most basic use-case

You can use the log_metadata function within a step:

from zenml import step, log_metadata

@step
def my_step() -> ...:
    log_metadata(metadata={"accuracy": 0.91})
    ...

This will log the accuracy for the step, its pipeline run, and if provided its model version.

Additional use-cases

The log_metadata function also supports various use-cases by allowing you to specify the target entity (e.g., model, artifact, step, or run) with flexible parameters. You can learn more about these use-cases in the following pages:

The older methods for logging metadata to specific entities, such as log_model_metadata, log_artifact_metadata, and log_step_metadata, are now deprecated. It is recommended to use log_metadata for all future implementations.

Last updated