Nestor
Nestor

Reputation: 13990

How to set a tag at the experiment level in MLFlow

I can see that an experiment in MLFlow can have tags (like runs can have tags). I'm able to set a run's tag using mlflow.set_tag, but how do I set it for an experiment?

Upvotes: 4

Views: 6858

Answers (2)

Maciej Skorski
Maciej Skorski

Reputation: 3364

While the client is very flexible, you can set tags at experiments with mlflow alone.

For instance, this is how to set a description visible in UI:

mlflow.set_experiment(experiment_name=EXPERIMENT_NAME)
mlflow.set_experiment_tag('mlflow.note.content',EXPERIMENT_DESCRIPTION)

enter image description here NOTE: tested under mlflow=2.3.2.

Upvotes: 0

Alex Ott
Alex Ott

Reputation: 87259

If you look into the Python API, the very first example in mlflow.tracking package that shows how to create the MLflowClient is really showing how to tag experiment using the client.set_experiment_tag function (doc):

from mlflow.tracking import MlflowClient

# Create an experiment with a name that is unique and case sensitive.
client = MlflowClient()
experiment_id = client.create_experiment("Social NLP Experiments")
client.set_experiment_tag(experiment_id, "nlp.framework", "Spark NLP")

you can also set it for model version with set_model_version_tag function, and for registered model with set_registered_model_tag.

Upvotes: 4

Related Questions