2

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?

Nestor
  • 13,706
  • 11
  • 78
  • 119
  • I see the rest API (https://www.mlflow.org/docs/latest/rest-api.html#set-experiment-tag), i'm trying to set it from Python – Nestor Oct 23 '21 at 16:12

2 Answers2

3

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.

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
0

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.

Maciej Skorski
  • 2,303
  • 6
  • 14