Azure ML Hyperdrive

Adrian Cartier 6 Reputation points
2021-04-06T15:34:40.093+00:00

When running the hyperdrive step, I would like to get the hyper parameters that were selected for the best model and export them to use in a subsequent model. How would I got about doing that? I saw a method get_hyperparameters but from what I can tell that just gets all child runs. I am essentially wanting to use the same model but change alpha levels.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,579 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 46,991 Reputation points
    2021-04-06T21:26:11.18+00:00

    Hello.

    I think below is what you are looking for. Could you please take a look?

    Once all of the hyperparameter tuning runs have completed, identify the best performing configuration and hyperparameter values:

    best_run = hyperdrive_run.get_best_run_by_primary_metric()
    best_run_metrics = best_run.get_metrics()
    parameter_values = best_run.get_details()['runDefinition']['Arguments']
    
    print('Best Run Id: ', best_run.id)
    print('\n Accuracy:', best_run_metrics['accuracy'])
    print('\n learning rate:',parameter_values[3])
    print('\n keep probability:',parameter_values[5])
    print('\n batch size:',parameter_values[7])
    

    Regards,
    Yutong