0

I'm using hyperopt to retrieve the best param for maxDepth for a decision tree.

I'm also using mlflow to create a new run for each value of maxDepth

When hyperopt finishes it returns the best run parameter.

I would like to use this to retrieve the corresponding run and then set a tag on that run to indicate that it is the best run:

# use hyperopt to retrieve the best param for maxDepth for a decision tree
# log the parameters and model using mlflow for each value of maxDepth

maxDepth = # this is set to best value by hyperopt

best_run = mlflow.search_runs(
  experiment_ids=experiment_id, 
  filter_string=f'params.maxDepth = {maxDepth}', 
  max_results=1, 
  run_view_type=ViewType.ACTIVE_ONLY, 
  output_format="list"
  )[0]

with mlflow.start_run(run_name=best_run.data.tags['mlflow.runName']) as run:

    # How to add a new tag, e.g. { 'best_run' : True }

How can I do this with mlflow?

I have seen similar questions (e.g. this one) asking about changing parameters but not for updating tags.

Chris Snow
  • 23,813
  • 35
  • 144
  • 309

0 Answers0