Designing and Implementing a Data Science Solution on Azure: DP-100 Exam - Order of Steps for Running ML Experiments

The Right Order of Steps for Running ML Experiments

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 running ML experiments on Azure depends on the specific libraries and frameworks being used, as well as the desired workflow. However, based on the given options, the correct answer is C: Workspace() -> Run.get_context() -> ScriptRunConfig() -> Experiment.submit().

Here is a detailed explanation of each step:

  1. Workspace(): The first step is to create a reference to the Azure Machine Learning workspace where the experiment will be run. The Workspace object represents the connection to the workspace and provides methods for managing the resources within it. This step is important to establish a connection to the workspace and retrieve necessary resources.

  2. Run.get_context(): The next step is to get the context of the current run. This is typically done using the Run.get_context() method, which returns a RunContext object that contains information about the current run, including the run ID and workspace details. This step is important to enable logging of metrics and artifacts for the experiment.

  3. ScriptRunConfig(): The next step is to create a ScriptRunConfig object, which represents the configuration for the script run. This object specifies the script file to run, the Python environment to use, and any command-line arguments to pass to the script. This step is important to define the configuration of the experiment, including the environment and the script that will be run.

  4. Experiment.submit(): The final step is to submit the experiment to the Azure Machine Learning workspace for execution. This is typically done using the Experiment.submit() method, which creates a new experiment run with the specified configuration and submits it to the workspace. This step is important to start the actual execution of the experiment and retrieve the results.

In summary, the correct order of the required steps within the Python script for running ML experiments on Azure is to first establish a connection to the workspace using the Workspace() method, then get the context of the current run using Run.get_context(), create a ScriptRunConfig object using ScriptRunConfig(), and finally submit the experiment using Experiment.submit().