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
Databricks Employee
Databricks Employee
2 REPLIES 2

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)

diogo_vieira
New Contributor II

And how about tracing data? Do you know how to read like

spark.read.format("mlflow-experiment").load()

 ?

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now