Custom Metrics

Log Metrics

To specify metrics, which can be tracked during the execution of the experiment, the user can call the following function.

prov4ml.log_metric(
    key: str, 
    value: float, 
    context: Optional[str] = None, 
    step: int = 0, 
    source: Optional[str] = None, 
    timestamp : int = 0
)
ParameterTypeDescription
keystringRequired. Name of the metric
valuefloatRequired. Value of the metric
contextOptional[prov4ml.str]Required. str of the metric
stepOptional[int]Optional. Step of the metric
sourceOptional[str]Optional. Source of the metric
timestampOptional[str]Optional. The time of logging of the current item in the metric

The step parameter is optional and can be used to specify the current time step of the experiment, for example the current epoch, it defaults to 0. In a similar manner, the context parameter can also be omitted, and it will default to the main experiment context. The source parameter is optional and can be used to specify the source of the metric, so for example which library the data comes from. If omitted, yProv4ML will try to automatically determine the origin.