kirpi
New Contributor II

I had this same problem, and followed the same steps, but it did not work until I also explicitly set the experiment_id of the children.


EXPERIMENT_NAME = '/Users/my_user_name/my_experiment'
experiment_id = mlflow.get_experiment_by_name(EXPERIMENT_NAME)

if experiment_id is None:
    experiment_id = mlflow.create_experiment(EXPERIMENT_NAME)
else:
    experiment_id = experiment_id.experiment_id
mlflow.set_experiment(experiment_id=experiment_id)

#
#
#

def train_model(params):
    with mlflow.start_run(nested=True, parent_run_id=params['parent_run_id'], experiment_id=params['experiment_id']):
        # training and logging here
#
#
#
search_space = #dict of parameters
with mlflow.start_run(run_name=my_run_name) as parent_run:
    run_id_value = parent_run.info.run_id
    search_space['parent_run_id'] = run_id_value
    search_space['experiment_id'] = experiment_id
    best_params = fmin(fn=train_model, 
                       space=search_space, 
                       #etc
                       )