
Answer-first summary for fast verification
Answer: No
The solution does NOT meet the goal because ScriptRunConfig by itself does not ensure the environment includes scikit-learn or other required packages for model training. While ScriptRunConfig correctly handles script execution on the compute target and uploads the source directory (including the training data file), it relies on the default environment which may not have scikit-learn installed. To ensure the required packages are available, the solution should either: 1) Use an Environment object with conda dependencies specified, or 2) Use the deprecated SKLearn estimator which automatically includes scikit-learn. The community discussion confirms this limitation, with the highest upvoted comment noting that while ScriptRunConfig is the modern approach, it requires explicit environment configuration for package dependencies.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You have a Python script named train.py in a local folder named scripts. The script trains a regression model using scikit-learn and includes code to load a training data file from the same scripts folder.
You must run the script as an Azure ML experiment on a compute cluster named aml-compute. You need to configure the run to ensure the environment includes the required packages for model training. You have instantiated a variable named aml_compute that references the target compute cluster.
Solution: Run the following code:
from azureml.core import ScriptRunConfig, Experiment
src = ScriptRunConfig(source_directory='scripts',
script='train.py',
compute_target=aml_compute)
run_config.run_config = src
experiment = Experiment(workspace=ws, name='train-experiment')
run = experiment.submit(src)
from azureml.core import ScriptRunConfig, Experiment
src = ScriptRunConfig(source_directory='scripts',
script='train.py',
compute_target=aml_compute)
run_config.run_config = src
experiment = Experiment(workspace=ws, name='train-experiment')
run = experiment.submit(src)
Does the solution meet the goal?

A
Yes
B
No
No comments yet.