Ultimate access to all questions.
You create a model to forecast weather conditions based on historical data. You need to create a pipeline that runs a processing script to load data from a datastore and pass the processed data to a machine learning model training script.
Solution: Run the following code:
from azureml.core import Workspace, Dataset, Experiment
from azureml.core.runconfig import RunConfiguration
from azureml.pipeline.core import Pipeline, PipelineData
from azureml.pipeline.steps import PythonScriptStep
# Define data reference
raw_data = Dataset.get_by_name(ws, 'raw_weather_data')
processed_data = PipelineData('processed_data', datastore=ws.get_default_datastore())
# Define processing step
process_step = PythonScriptStep(
name='process_data',
script_name='process.py',
arguments=['--input', raw_data.as_named_input('input'), '--output', processed_data],
inputs=[raw_data],
outputs=[processed_data],
compute_target=compute_target,
runconfig=run_config
)
# Define training step
train_step = PythonScriptStep(
name='train_model',
script_name='train.py',
arguments=['--input', processed_data],
inputs=[processed_data],
compute_target=compute_target,
runconfig=run_config
)
# Create and run pipeline
pipeline = Pipeline(workspace=ws, steps=[process_step, train_step])
pipeline_run = Experiment(ws, 'weather_forecast').submit(pipeline)
Does the solution meet the goal?