Manually log metrics with Vertex AI Experiments

TensorBoard time series metrics can be manually logged with a Vertex AI Experiments run. These metrics are visualized in the Vertex AI Experiments console, or in your Vertex AI TensorBoard experiment web app.

For more details on logging metrics and parameters, see Manually log data to an experiment run.

Python

def log_time_series_metrics_sample(
    experiment_name: str,
    run_name: str,
    metrics: Dict[str, float],
    step: Optional[int],
    wall_time: Optional[timestamp_pb2.Timestamp],
    project: str,
    location: str,
):
    aiplatform.init(experiment=experiment_name, project=project, location=location)

    aiplatform.start_run(run=run_name, resume=True)

    aiplatform.log_time_series_metrics(metrics=metrics, step=step, wall_time=wall_time)

  • experiment_name: Provide a name for your experiment.
  • run_name: Provide a run name.
  • metrics: Dictionary of where keys are metric names and values are metric values.
  • step: Optional. Step index of this data point within the run.
  • wall_time: Optional. Wall clock timestamp when this data point is generated by the end user. If not provided, wall_time is generated based on the value from time.time().
  • project: Your project ID. You can find these IDs in the Google Cloud console welcome page.
  • location: See List of available locations. Be sure to use a region that supports TensorBoard if creating a TensorBoard instance.