Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get metrics and hyperparameters for each run in HyperDriveStepRun in Azure Machine Learning
# Get the HyperDriveStep of the pipeline by name (make sure only 1 exists)
hd_step_run = HyperDriveStepRun(step_run=pipeline_run.find_step_run('hd_step01')[0])
# Get RunID for best run (we're lazy)
best_run_id = hd_step_run.get_best_run_by_primary_metric().id
# Get all hyperparameters that where tried
hyperparameters = hd_step_run.get_hyperparameters()
# Get all metrics for the runs
metrics = hd_step_run.get_metrics()
# Iterate through all runs and print metrics + hyperparameters
for run_id, hp in hyperparameters.items():
print(run_id, "===========")
print("Hyperparameters:\n", hp)
print("Metrics:\n", metrics[run_id])
# Just for the best run
print("BEST RUN:", best_run_id)
print("Hyperparameters for best run:\n", hyperparameters[best_run_id])
print("Metrics of best run:\n", metrics[best_run_id])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.