Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,339 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How to get the data of the metrics logged by a job using python sdk v2
Based on the documentation, you need to authenticate first then you can retrieve the job using its ID and then access the logged metrics :
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential
# Use DefaultAzureCredential for authentication
credential = DefaultAzureCredential()
# Your subscription ID, resource group, and workspace name
subscription_id = 'your-subscription-id'
resource_group = 'your-resource-group'
workspace_name = 'your-workspace-name'
# Create MLClient
ml_client = MLClient(credential, subscription_id, resource_group, workspace_name)
job_name = 'your-job-name'
# Retrieve the job
job = ml_client.jobs.get(name=job_name)
# Access the metrics logged by the job
metrics = job.outputs.get('logs') or job.outputs.get('metrics')
if metrics:
print(metrics)
else:
print("No metrics found for job:", job_name)