cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
cancel
Showing results for 
Search instead for 
Did you mean: 

Can we retrieve experiment results via MLflow API or is this only possible using UI?

User15787040559
New Contributor III
1 REPLY 1

Mooune_DBU
Valued Contributor

There are many ways you can retrieve experiments results using the mlflow API (see example if you want to retrieve and display for only a specific model (assuming you have the `model_name`:

best_models = mlflow.search_runs(filter_string=f'tags.model="{model_name}" and attributes.status = "FINISHED" and metrics.F1 > 0', order_by=['metrics.F1 DESC'], max_results=1)

In Databricks my other favorite way to query runs for ad-hoc analytics is via the "mlflow-experiment" format:

df_client = spark.read.format("mlflow-experiment").load()
df_client.createOrReplaceTempView("vw_client")

Following which one can run queries slice/dice results using SparkSQL:

df_model_selector = spark.sql("""SELECT experiment_id, run_id, metrics.auc as AUC, metrics.F1 as F1, artifact_uri 
 
    FROM vw_client 
    
    WHERE status='FINISHED'
    ORDER BY metrics.f1 desc
 
  """)
display(df_model_selector)

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.