Designing and Implementing a Data Science Solution on Azure: DP-100 Exam Question

Configure and Run ML Experiments with Python Script | DP-100 Exam

Question

For running your ML experiments, you want to create a separate Python script for configuring and running the experiment, and store it in a folder for future use.

While writing the script, there is a list of key steps you have to include in a specific order.

Which of the following options reflects the right order of the required steps within the script?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer: C.

Option A is incorrect because defining compute targets is not part of the experiment script; instead of RunConfiguration() the Run.get_context() has to be used.

Option B is incorrect because connecting to a Machine Learning workspace must be the very first step.

Option C is CORRECT because the very first step is connection to an ML workspace, then the run context for running the script has to be retrieved, then a ScriptRunConfig is needed to define the script to be run.

Finally, you have to submit the experiment by the submit() method.

Option D is incorrect because the Experiment.submit() method must be used as the last step, in order to run the experiment.

Reference:

The correct order of the required steps within the Python script for configuring and running an ML experiment on Azure is:

C. Workspace() -> Run.get_context() -> ScriptRunConfig() -> Experiment.submit()

Here is a detailed explanation of each step:

  1. Workspace(): This step involves creating a workspace object in Python. The workspace is a central place where you can manage your Azure Machine Learning resources such as data, models, and compute targets.

  2. Run.get_context(): In this step, you create a run context object that is used to manage the execution of the script. This step also allows you to access various resources related to the run such as input and output data paths.

  3. ScriptRunConfig(): This step involves creating a script run configuration object that is used to specify the details of the Python script to be run, such as the entry point script file, the compute target to use, and the environment to use for running the script.

  4. Experiment.submit(): Finally, you submit the experiment to the Azure Machine Learning service by creating an experiment object and using its submit method. This step starts the execution of the script on the specified compute target.

Option A is incorrect because it starts with the Workspace() step, which is correct, but then it moves on to Compute target(), which should actually be done later in the ScriptRunConfig() step. Also, it skips the important Run.get_context() step.

Option B is incorrect because it starts with the Run.get_context() step, which should actually come after the Workspace() step. Also, it skips the ScriptRunConfig() step.

Option D is incorrect because it starts with the Workspace() step, which is correct, but then it moves on to ScriptRunConfig() before the important Run.get_context() step.

Therefore, option C is the correct order of steps to follow for configuring and running an ML experiment in Azure.