
Answer-first summary for fast verification
Answer: No
The solution does NOT meet the goal because it fails to ensure the environment includes the required packages for scikit-learn model training. While ScriptRunConfig is the modern approach for running scripts in Azure ML, the code sets `src.run_config.framework = 'scikit-learn'` which is incorrect - there is no 'framework' property in ScriptRunConfig's run_config. The proper way to specify the environment is either by using a curated environment (like `Environment.get(ws, 'AzureML-sklearn-0.24-ubuntu18.04-py37-cpu')`) or by creating a custom environment with required packages. The community discussion confirms this is outdated, with multiple comments noting the SKLearn estimator approach is deprecated and ScriptRunConfig should be used with proper environment configuration. The solution lacks any environment specification, so it cannot guarantee scikit-learn packages will be available on the compute cluster.
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)
src.run_config.framework = 'scikit-learn'
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)
src.run_config.framework = 'scikit-learn'
experiment = Experiment(workspace=ws, name='train-experiment')
run = experiment.submit(src)
Does the solution meet the goal?

A
Yes
B
No
No comments yet.