Created
October 14, 2020 15:08
-
-
Save csiebler/fa4f22e179b675a72e8fe40dcb070ab1 to your computer and use it in GitHub Desktop.
Get metrics and hyperparameters for each run in HyperDriveStepRun in Azure Machine Learning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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