Skip to content

Commit 6f5c5f9

Browse files
authored
Merge pull request #53832 from MicrosoftDocs/NEW-optimize-ml
New module - optimize ml
2 parents 8aeca6c + 8c767ad commit 6f5c5f9

19 files changed

Lines changed: 644 additions & 0 deletions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.introduction
3+
title: Introduction
4+
metadata:
5+
title: Introduction
6+
description: Learn how to run scripts as command jobs and track model training with MLflow in Azure Machine Learning.
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
durationInMinutes: 2
14+
content: |
15+
[!include[](includes/1-introduction.md)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.convert-notebook-script
3+
title: Convert a notebook to a script
4+
metadata:
5+
title: Convert a notebook to a script
6+
description: Learn how to get your code production ready.
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
durationInMinutes: 5
14+
content: |
15+
[!include[](includes/2-convert-notebook-script.md)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.run-script-command-job
3+
title: Run a script as a command job
4+
metadata:
5+
title: Run a script as a command job
6+
description: Learn how to run a script as a command job in Azure Machine Learning.
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
durationInMinutes: 3
14+
content: |
15+
[!include[](includes/3-run-script-command-job.md)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.use-parameters-command-job
3+
title: Use parameters in a command job
4+
metadata:
5+
title: Use parameters in a command job
6+
description: Learn how to use parameters in a command job.
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
durationInMinutes: 3
14+
content: |
15+
[!include[](includes/4-use-parameters-command-job.md)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.track-metrics
3+
title: Track metrics with MLflow
4+
metadata:
5+
title: Track metrics with MLflow
6+
description: Learn how to track metrics with MLflow in scripts in Azure Machine Learning.
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
durationInMinutes: 5
14+
content: |
15+
[!include[](includes/5-track-metrics.md)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.view-metrics-evaluate-models
3+
title: View metrics and evaluate models
4+
metadata:
5+
title: View metrics and evaluate models
6+
description: Learn how to retrieve metrics and evaluate models in Azure Machine Learning.
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
durationInMinutes: 6
14+
content: |
15+
[!include[](includes/6-view-metrics-evaluate-models.md)]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.exercise
3+
title: Exercise - Optimize model training in Azure Machine Learning
4+
metadata:
5+
title: Exercise - Optimize model training in Azure Machine Learning
6+
description: Explore how to run a script as a command job and track model metrics with MLflow in Azure Machine Learning through hands-on exercises.
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
durationInMinutes: 20
14+
content: |
15+
[!include[](includes/7-exercise.md)]
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.knowledge-check
3+
title: Module assessment
4+
metadata:
5+
title: Module assessment
6+
description: Knowledge check
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
module_assessment: true
14+
durationInMinutes: 4
15+
quiz:
16+
questions:
17+
- content: "A data scientist wants to run a script as a command job to train a PyTorch model, setting the batch size and learning rate hyperparameters to specified values each time the job runs. What should be done by the data scientist?"
18+
choices:
19+
- content: "Create multiple script files – one for each batch size and learning rate combination you want to use."
20+
isCorrect: false
21+
explanation: "Incorrect. To use different values each time, define arguments in the script and pass them using the arguments parameter of the command job."
22+
- content: "Set the batch size and learning rate properties of the command job before submitting the job."
23+
isCorrect: false
24+
explanation: "Incorrect. To use different values each time, define arguments in the script and pass them using the arguments parameter of the command job."
25+
- content: "Add arguments for batch size and learning rate to the script, and set them in the command property of the command job."
26+
isCorrect: true
27+
explanation: "Correct. To use different values each time, define arguments in the script and pass them using the arguments parameter of the command job."
28+
- content: "A data scientist has trained a model in a notebook. The model should be retrained every week on new data. What should the data scientist do to make the code production-ready?"
29+
choices:
30+
- content: "Copy and paste the code from each cell to a script."
31+
isCorrect: false
32+
explanation: "Incorrect. The code in a notebook is likely to contain nonessential exploratory code that should be omitted in a script."
33+
- content: "Convert the code to one function in a script that reads the data and trains the model."
34+
isCorrect: false
35+
explanation: "Incorrect. A script will be easier to test and maintain by others when it exists of multiple functions."
36+
- content: "Convert the code to multiple functions in a script that read the data and train the model."
37+
isCorrect: true
38+
explanation: "Correct. A script consisting of multiple functions is best to use for production workloads."
39+
- content: "A data scientist trains a regression model and wants to track the model's performance by storing the Root Mean Squared Error (RMSE) with the experiment run. Which method can be used to log the RMSE?"
40+
choices:
41+
- content: "`mlflow.log_param()`"
42+
isCorrect: false
43+
explanation: "Incorrect. Use `mlflow.log_param()` to log an input parameter."
44+
- content: "`mlflow.log_artifact()`"
45+
isCorrect: false
46+
explanation: "Incorrect. Use `mlflow.artifact()` to log plots and images."
47+
- content: "`mlflow.log_metric()`"
48+
isCorrect: true
49+
explanation: "Correct. Use `mlflow.log_metric()` to log a metric like the RMSE."
50+
- content: "When a data scientist enables MLflow autologging, where can all model assets be found?"
51+
choices:
52+
- content: "In the model folder under **Outputs + logs**."
53+
isCorrect: true
54+
explanation: "Correct. Model assets like the model pickle file will be stored in the model folder under Outputs + logs."
55+
- content: "In the outputs folder under **Outputs + logs**."
56+
isCorrect: false
57+
explanation: "Incorrect. When the data scientist enables autologging, the model assets won't be stored in the outputs folder."
58+
- content: "In the model folder under **Metrics**."
59+
isCorrect: false
60+
explanation: "Incorrect. Artifacts like the model assets aren't stored under Metrics."
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### YamlMime:ModuleUnit
2+
uid: learn.wwl.run-training-scripts-track-models-mlflow.summary
3+
title: Summary
4+
metadata:
5+
title: Summary
6+
description: In this module, you've learned how to run scripts as command jobs and track model training with MLflow in Azure Machine Learning.
7+
author: wwlpublish
8+
ms.author: madiepev
9+
ms.date: 03/12/2026
10+
ms.topic: unit
11+
ms.collection:
12+
- wwl-ai-copilot
13+
durationInMinutes: 1
14+
content: |
15+
[!include[](includes/9-summary.md)]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
A common challenge when developing machine learning models is to prepare for production scenarios. When you write code to process data and train models, you want the code to be scalable, repeatable, and ready for automation.
2+
3+
Though notebooks are ideal for experimentation and development, scripts are a better fit for production workloads. In Azure Machine Learning, you can run a script as a **command job**. When you submit a command job, you can configure various parameters like the input data and the compute environment.
4+
5+
Once your training script runs as a job, you also want to monitor the model's performance over time. You can use **MLflow** to track metrics, parameters, and artifacts directly from your scripts. MLflow is an open-source platform integrated with Azure Machine Learning that lets you compare runs and decide on next steps.
6+
7+
## Learning objectives
8+
9+
In this module, you learn how to:
10+
11+
- Convert a notebook to a script.
12+
- Test scripts in a terminal.
13+
- Run a script as a command job.
14+
- Use parameters in a command job.
15+
- Use MLflow when you run a script as a job.
16+
- Review metrics, parameters, artifacts, and models from a run.
17+
18+
Let's start by exploring why scripts are a better choice than notebooks for production machine learning workloads. And how to convert your existing notebooks into reusable, production-ready scripts.

0 commit comments

Comments
 (0)