DP-100 practice question 6 of 35

You create a script that trains a convolutional neural network model over multiple epochs and logs the validation loss after each epoch. The script…

Full set: 506 questions

Domain Run experiments and train models

You create a script that trains a convolutional neural network model over multiple epochs and logs the validation loss after each epoch. The script includes arguments for batch size and learning rate. You identify a set of batch size and learning rate values that you want to try. You need to use Azure Machine Learning to find the combination of batch size and learning rate that results in the model with the lowest validation loss. What should you do?
Answer options
A: Run the script in an experiment based on an AutoMLConfig object
B: Create a PythonScriptStep object for the script and run it in a pipeline
C: Use the Automated Machine Learning interface in Azure Machine Learning studio
D: Run the script in an experiment based on a ScriptRunConfig object
E: Run the script in an experiment based on a HyperDriveConfig object Correct answer
Correct Answer:
E. Run the script in an experiment based on a HyperDriveConfig object
Explanation

The user's goal is to find the optimal combination of batch size and learning rate for a custom training script by minimizing the validation loss. This process is known as hyperparameter tuning. Azure Machine Learning provides the HyperDrive service specifically for this task. A HyperDriveConfig object is used to configure the tuning experiment. It defines the script to run (via a ScriptRunConfig), the hyperparameter space to search, the sampling method, the primary metric to optimize (validation loss), and an optional early termination policy. HyperDrive then automates launching and managing multiple child runs to efficiently find the best hyperparameter combination based on the logged metric.

Why Incorrect

A. Run the script in an experiment based on an AutoMLConfig object Automated ML (AutoML) automatically selects and tunes algorithms from its own predefined set; it does not tune the hyperparameters of a user-provided custom script.
B. Create a PythonScriptStep object for the script and run it in a pipeline A PythonScriptStep is for executing a single script within a larger workflow. It does not provide the automated search and optimization capabilities required for hyperparameter tuning.
C. Use the Automated Machine Learning interface in Azure Machine Learning studio This is the user interface for AutoML (Option A). It is used for automated model selection and tuning, not for optimizing a custom user script.
D. Run the script in an experiment based on a ScriptRunConfig object A ScriptRunConfig is used to configure and submit a single training run. While it is a necessary component for a HyperDrive run, it cannot perform the tuning process on its own.

References

1. Microsoft Azure Official Documentation

"Tune hyperparameters for your model with Azure Machine Learning": This document explicitly states

"Automate efficient hyperparameter tuning by using Azure Machine Learning HyperDrive package." It details the required components for a HyperDrive run: a training script

a defined hyperparameter space

a primary metric to optimize

and a termination policy

which directly aligns with the user's scenario.

Source: Microsoft Learn

learn.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters

Section: "What is hyperparameter tuning?".

2. Microsoft Azure Official Documentation

HyperDriveConfig class: The SDK reference for the HyperDriveConfig class shows that its constructor requires a run configuration (like ScriptRunConfig)

a hyperparametersampling object

and a primarymetricname. This confirms it is the specific object designed to configure a hyperparameter tuning experiment around a user's script.

Source: Microsoft Learn

learn.microsoft.com/en-us/python/api/azureml-train-hyperdrive/azureml.train.hyperdrive.hyperdriveconfig

Class constructor parameters.

3. Microsoft Azure Official Documentation

"What is automated machine learning (AutoML)?": This document clarifies that AutoML is for training and tuning models on a given dataset by iterating over algorithms and feature selections. It does not integrate and tune an external

user-defined training script.

Source: Microsoft Learn

learn.microsoft.com/en-us/azure/machine-learning/concept-automated-ml

Section: "When to use AutoML".

Scroll to Top