Hi @AnnamalaiVR,
Thank you for posting the question in Databricks Community.
In your Python code, import the MLflow library and create a client object to access your Model Registry.
%python
import mlflow
# Set the Databricks tracking URI
databricks_host = "*********************"
databricks_token = "**********"
databricks_org_id = "******"
tracking_uri = f"databricks://{databricks_host}?org_id={databricks_org_id}"
mlflow.set_tracking_uri(tracking_uri)
# Configure the MLflow client
client = mlflow.tracking.MlflowClient()
Now you can query the Model Registry using the client object. Here's an example to fetch the registered model versions for a given model name:
%python
model_name = "my_model"
model_versions = client.search_model_versions(f"name='{model_name}'")
for model_version in model_versions:
# Fetch the run ID and metrics for the model version
run_id = model_version.run_id
metrics = client.get_run(run_id).data.metrics
# Add the metrics to a dictionary
accuracy_score = metrics["accuracy score"]
nw_dict[run_id] = accuracy_score
Make sure to replace the model_name variable with the name of your registered model.