DP-100 · Question #151
You create a multi-class image classification deep learning model that uses the PyTorch deep learning framework. You must configure Azure Machine Learning Hyperdrive to optimize the hyperparameters…
The correct answer is A. Set the primary_metric_goal of the estimator used to run the bird_classifier_train.py script to D. Set the primary_metric_name of the estimator used to run the bird_classifier_train.py script to F. Add code to the bird_classifier_train.py script to calculate the validation accuracy of the model. Three actions are required to configure Hyperdrive to optimize for accuracy. First (F): the training script bird_classifier_train.py must contain code that calculates validation accuracy and logs it using run.log('validation_accuracy', value). Hyperdrive reads metrics from the…
Question
Options
- ASet the primary_metric_goal of the estimator used to run the bird_classifier_train.py script to
- BAdd code to the bird_classifier_train.py script to calculate the validation loss of the model and log
- CSet the primary_metric_goal of the estimator used to run the bird_classifier_train.py script to
- DSet the primary_metric_name of the estimator used to run the bird_classifier_train.py script to
- ESet the primary_metric_name of the estimator used to run the bird_classifier_train.py script to
- FAdd code to the bird_classifier_train.py script to calculate the validation accuracy of the model
How the community answered
(48 responses)- A81% (39)
- B10% (5)
- C2% (1)
- E6% (3)
Explanation
Three actions are required to configure Hyperdrive to optimize for accuracy. First (F): the training script bird_classifier_train.py must contain code that calculates validation accuracy and logs it using run.log('validation_accuracy', value). Hyperdrive reads metrics from the run logs, so the metric must be explicitly logged inside the training script. Second (D): the primary_metric_name in the HyperDriveConfig must be set to the exact string name logged in the script (e.g., 'validation_accuracy'). This tells Hyperdrive which logged value to track across child runs. Third (A): primary_metric_goal must be set to PrimaryMetricGoal.MAXIMIZE, because a higher accuracy score is better. Options B and C are distractors likely involving validation loss (which would be minimized, not maximized) and options E references the wrong metric name, none of which align with optimizing for accuracy.
Topics
Community Discussion
No community discussion yet for this question.