I want to get the name of the experiment that contains the run that created a registered MLflow model. How can I do this using MLflow, if I just have the name of the model and the version?
I want to get the name of the experiment that contains the run that created a registered MLflow model. How can I do this using MLflow, if I just have the name of the model and the version?
The registered model version has a pointer to the run ID. You can then get the experiment_id from the run, and with this get all the experiment info. Look at the API docs.
As @Andre has said, I had to write my own function to achieve this,
def get_model_experiment(model_name, model_version):
# get run_id of the model version
run_id = mlflow_client.get_model_version(model_name, model_version).run_id
# get the experiment_id from the run_id
experiment_id = mlflow_client.get_run(run_id).info.experiment_id
# get the experiment name from the experiment_id
return mlflow_client.get_experiment(experiment_id).name