cancel
Showing results for 
Search instead for 
Did you mean: 
Machine Learning
Dive into the world of machine learning on the Databricks platform. Explore discussions on algorithms, model training, deployment, and more. Connect with ML enthusiasts and experts.
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)

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!