nerdexam
MicrosoftMicrosoft

DP-100 · Question #19

DP-100 Question #19: Real Exam Question with Answer & Explanation

The user needs to select and order code segments to correctly import and instantiate the TruncationSelectionPolicy for early stopping in Azure ML's hyperdrive.

Train and deploy models

Question

Drag and Drop Question You need to implement an early stopping criteria policy for model training. Which three code segments should you use to develop the solution? To answer, move the appropriate code segments from the list of code segments to the answer area and arrange them in the correct order. NOTE: More than one order of answer choices is correct. You will receive credit for any of the correct orders you select. Answer:

Explanation

The user needs to select and order code segments to correctly import and instantiate the TruncationSelectionPolicy for early stopping in Azure ML's hyperdrive.

Approach. The goal is to implement an early stopping policy using TruncationSelectionPolicy. To achieve this, the necessary steps are to first specify the module from which to import, then import the specific class, and finally, instantiate that class. The correct interaction involves dragging the following three code segments into the 'Answer Area' in the specified order:

  1. 'from azureml.train.hyperdrive': This specifies the module within Azure ML from which the early stopping policies are imported.
  2. 'import TruncationSelectionPolicy': This imports the specific TruncationSelectionPolicy class from the previously specified module.
  3. 'early_termination_policy = TruncationSelectionPolicy(evaluation_interval=1, truncation_percentage=20, delay_evaluation=5)': This instantiates the TruncationSelectionPolicy with the given parameters, which define how the early stopping criteria will be applied during hyperparameter tuning, and assigns it to the early_termination_policy variable.

This order ensures that the required class is correctly imported and available in the scope before it is used to create an object, following standard Python syntax and execution flow.

Common mistakes.

  • common_mistake. A common mistake is selecting code segments related to BanditPolicy instead of TruncationSelectionPolicy. While BanditPolicy is also an early stopping policy, the question provides a complete set of code for TruncationSelectionPolicy, making it the intended solution. Another mistake would be to place the instantiation of the TruncationSelectionPolicy before its import (e.g., placing early_termination_policy = TruncationSelectionPolicy(...) before the from and import statements), which would lead to a NameError because the class would not be defined yet. Incorrectly ordering the from and import statements (e.g., placing import TruncationSelectionPolicy before from azureml.train.hyperdrive) would also be syntactically incorrect in Python, as these two parts combine to form a single, valid import statement (from module import class).

Concept tested. Azure Machine Learning Hyperdrive, early stopping policies (specifically TruncationSelectionPolicy), Python module import mechanisms, and object instantiation.

Topics

#Early stopping#Model training#Azure Machine Learning#Experimentation

Community Discussion

No community discussion yet for this question.

Full DP-100 PracticeBrowse All DP-100 Questions