
Answer-first summary for fast verification
Answer: run = script_experiment.submit(config=script_config)
The correct answer is D because the `submit()` method of the Experiment class is used to start an experiment run with a specified configuration. In this case, `script_experiment.submit(config=script_config)` submits the ScriptRunConfig (which specifies the script, source directory, and local compute target) to begin execution. Option A (`start_logging()`) is for interactive runs in notebooks, not script submissions. Option B (`Run(experiment=script_experiment)`) incorrectly instantiates a Run object without starting the experiment. Option C (`ws.get_run(run_id=experiment.id)`) retrieves an existing run by ID but does not start a new one. The community discussion, with 100% consensus and upvoted comments, confirms D is correct, emphasizing that 'submit' is the keyword to initiate the run.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You have the following code that prepares an experiment to run a script:
from azureml.core import Experiment, ScriptRunConfig
script_config = ScriptRunConfig(source_directory='./script',
script='train.py',
compute_target='local')
from azureml.core import Experiment, ScriptRunConfig
script_config = ScriptRunConfig(source_directory='./script',
script='train.py',
compute_target='local')
The experiment must be run on the local computer using the default environment. You need to add code to start the experiment and run the script. Which code segment should you use?

A
run = script_experiment.start_logging()
B
run = Run(experiment=script_experiment)
C
ws.get_run(run_id=experiment.id)
D
run = script_experiment.submit(config=script_config)
No comments yet.