Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Vertex AI experiments

Hello,

I am an MLFlow user trying to test Vertex Experiments. I was wondering how can we log artifacts when running experiments locally. 

And also is it possible to log graphs like feature importance as an html file in the vertex AI experiments UI ?  (This is possible in MLFLOW)

Solved Solved
0 2 1,718
1 ACCEPTED SOLUTION

In Vertex AI Experiments, you can log artifacts by using the Vertex SDK's log_artifact() method. When running experiments locally, you'll need to ensure that you have set up your Vertex SDK and configured it properly to log artifacts.

To log artifacts using Vertex SDK in Python, you can follow this example:

from google.cloud import aiplatform

# Initialize the Vertex SDK client
aiplatform.init()

# Log artifact
experiment = aiplatform.init(
experiment="YOUR_EXPERIMENT_NAME",
display_name="YOUR_EXPERIMENT_DISPLAY_NAME"
)

experiment.log_artifact("path/to/local/artifact", artifact_name="my_artifact")


Regarding logging graphs like feature importance as an HTML file in the Vertex AI Experiments UI, it's not directly supported in Vertex AI Experiments. However, you can potentially save the feature importance graphs as HTML files and log them as artifacts. Then, when viewing the experiment runs in the Vertex AI Experiments UI, you should be able to see and download these artifacts.

Make sure that the HTML file you're saving contains the feature importance graph or visualization you want to log.

View solution in original post

2 REPLIES 2

In Vertex AI Experiments, you can log artifacts by using the Vertex SDK's log_artifact() method. When running experiments locally, you'll need to ensure that you have set up your Vertex SDK and configured it properly to log artifacts.

To log artifacts using Vertex SDK in Python, you can follow this example:

from google.cloud import aiplatform

# Initialize the Vertex SDK client
aiplatform.init()

# Log artifact
experiment = aiplatform.init(
experiment="YOUR_EXPERIMENT_NAME",
display_name="YOUR_EXPERIMENT_DISPLAY_NAME"
)

experiment.log_artifact("path/to/local/artifact", artifact_name="my_artifact")


Regarding logging graphs like feature importance as an HTML file in the Vertex AI Experiments UI, it's not directly supported in Vertex AI Experiments. However, you can potentially save the feature importance graphs as HTML files and log them as artifacts. Then, when viewing the experiment runs in the Vertex AI Experiments UI, you should be able to see and download these artifacts.

Make sure that the HTML file you're saving contains the feature importance graph or visualization you want to log.

Thanks for your answer. For the artifacts it's ok.
For the artifacts maybe a workaround exists saving them in tensorboard.