Skip to content

Commit 4c7fa6e

Browse files
Merge pull request #270013 from sdgilley/sdg-freshness
update how-to-r-train-model
2 parents 4957cb2 + 3aed1ab commit 4c7fa6e

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

articles/machine-learning/how-to-r-train-model.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ titleSuffix: Azure Machine Learning
44
description: 'Learn how to train your machine learning model with R for use in Azure Machine Learning.'
55
ms.service: machine-learning
66
ms.subservice: core
7-
ms.date: 01/12/2023
7+
ms.date: 03/22/2024
88
ms.topic: how-to
99
author: wahalulu
1010
ms.author: mavaisma
@@ -24,8 +24,8 @@ This article explains how to take the R script that you [adapted to run in produ
2424
## Prerequisites
2525

2626
- An [Azure Machine Learning workspace](quickstart-create-resources.md).
27-
- [A registered data asset](how-to-create-data-assets.md) that your training job will use.
28-
- Azure [CLI and ml extension installed](how-to-configure-cli.md). Or use a [compute instance in your workspace](quickstart-create-resources.md), which has the CLI preinstalled.
27+
- [A registered data asset](how-to-create-data-assets.md) that your training job uses.
28+
- Azure [CLI and ml extension installed](how-to-configure-cli.md). Or use a [compute instance in your workspace](quickstart-create-resources.md), which has the CLI preinstalled.
2929
- [A compute cluster](how-to-create-attach-compute-cluster.md) or [compute instance](quickstart-create-resources.md#create-a-compute-instance) to run your training job.
3030
- [An R environment](how-to-r-modify-script-for-production.md#create-an-environment) for the compute cluster to use to run the job.
3131

@@ -44,18 +44,17 @@ Create this folder structure for your project:
4444
> [!IMPORTANT]
4545
> All source code goes in the `src` directory.
4646
47-
* The **r-source.R** file is the R script that you adapted to run in production
48-
* The **azureml_utils.R** file is necessary. The source code is shown [here](how-to-r-modify-script-for-production.md#source-the-azureml_utilsr-helper-script)
49-
47+
* The **r-source.R** file is the R script that you adapted to run in production. Make sure you follow the steps to [crate and log your model](how-to-r-modify-script-for-production.md#crate-your-models-with-the-carrier-package) in this script.
48+
* The **azureml_utils.R** file is necessary. Use [this source code](how-to-r-modify-script-for-production.md#source-the-azureml_utilsr-helper-script) for the contents of the file.
5049

5150

5251
## Prepare the job YAML
5352

54-
Azure Machine Learning CLI v2 has different [different YAML schemas](reference-yaml-overview.md) for different operations. You'll use the [job YAML schema](reference-yaml-job-command.md) to submit a job. This is the **job.yml** file that is a part of this project.
53+
Azure Machine Learning CLI v2 has different [different YAML schemas](reference-yaml-overview.md) for different operations. You use the [job YAML schema](reference-yaml-job-command.md) to submit a job in the **job.yml** file that is a part of this project.
5554

56-
You'll need to gather specific pieces of information to put into the YAML:
55+
You need to gather specific pieces of information to put into the YAML:
5756

58-
- The name of the registered data asset you'll use as the data input (with version): `azureml:<REGISTERED-DATA-ASSET>:<VERSION>`
57+
- The name of the registered data asset you use as the data input (with version): `azureml:<REGISTERED-DATA-ASSET>:<VERSION>`
5958
- The name of the environment you created (with version): `azureml:<R-ENVIRONMENT-NAME>:<VERSION>`
6059
- The name of the compute cluster: `azureml:<COMPUTE-CLUSTER-NAME>`
6160

@@ -66,7 +65,7 @@ You'll need to gather specific pieces of information to put into the YAML:
6665

6766
### Sample YAML schema to submit a job
6867

69-
Edit your **job.yml** file to contain the following. Make sure to replace values shown `<IN-BRACKETS-AND-CAPS>` and remove the brackets.
68+
Edit your **job.yml** file to contain the following. Make sure to replace values shown `<IN-BRACKETS-AND-CAPS>` and remove the brackets.
7069

7170
```yml
7271
$schema: https://azuremlschemas.azureedge.net/latest/commandJob.schema.json
@@ -102,7 +101,7 @@ Find these values from [Azure Machine Learning studio](https://ml.azure.com):
102101
103102
1. Sign in and open your workspace.
104103
1. In the upper right Azure Machine Learning studio toolbar, select your workspace name.
105-
1. You can copy the values from the section that appears.
104+
1. You can copy the values from the section that appears.
106105
107106
:::image type="content" source="media/how-to-r-train-model/find-values.png" alt-text="Screenshot: Find the values to use in your CLI command." lightbox="media/how-to-r-train-model/find-values.png":::
108107
@@ -114,7 +113,7 @@ To submit the job, run the following commands in a terminal window:
114113
cd r-job-azureml
115114
```
116115

117-
1. Sign in to Azure. If you're doing this from an [Azure Machine Learning compute instance](quickstart-create-resources.md#create-a-compute-instance), use:
116+
1. Sign in to Azure. If you're doing this from an [Azure Machine Learning compute instance](quickstart-create-resources.md#create-a-compute-instance), use:
118117

119118
```azurecli
120119
az login --identity
@@ -128,13 +127,13 @@ To submit the job, run the following commands in a terminal window:
128127
az upgrade
129128
```
130129

131-
1. If you have multiple Azure subscriptions, set the active subscription to the one you're using for your workspace. (You can skip this step if you only have access to a single subscription.) Replace `<SUBSCRIPTION-NAME>` with your subscription name. Also remove the brackets `<>`.
130+
1. If you have multiple Azure subscriptions, set the active subscription to the one you're using for your workspace. (You can skip this step if you only have access to a single subscription.) Replace `<SUBSCRIPTION-NAME>` with your subscription name. Also remove the brackets `<>`.
132131

133132
```azurecli
134133
az account set --subscription "<SUBSCRIPTION-NAME>"
135134
```
136135

137-
1. Now use CLI to submit the job. If you're doing this on a compute instance in your workspace, you can use environment variables for the workspace name and resource group as show in the following code. If you aren't on a compute instance, replace these values with your workspace name and resource group.
136+
1. Now use CLI to submit the job. If you're doing this on a compute instance in your workspace, you can use environment variables for the workspace name and resource group as show in the following code. If you aren't on a compute instance, replace these values with your workspace name and resource group.
138137

139138
```azurecli
140139
az ml job create -f job.yml --workspace-name $CI_WORKSPACE --resource-group $CI_RESOURCE_GROUP
@@ -146,28 +145,28 @@ Once you've submitted the job, you can check the status and results in studio:
146145
1. Select your workspace if it isn't already loaded.
147146
1. On the left navigation, select **Jobs**.
148147
1. Select the **Experiment name** that you used to train your model.
149-
1. Select the **Display name** of the job to view details and artifacts of the job, including metrics, images, child jobs, outputs, logs, and code used in the job.
148+
1. Select the **Display name** of the job to view details and artifacts of the job, including metrics, images, child jobs, outputs, logs, and code used in the job.
150149

151150

152151
## Register model
153152

154-
Finally, once the training job is complete, register your model if you want to deploy it. Start in the studio from the page showing your job details.
153+
Finally, once the training job is complete, register your model if you want to deploy it. Start in the studio from the page showing your job details.
155154

156155
1. Once your job completes, select **Outputs + logs** to view outputs of the job.
157-
1. Open the **models** folder to verify that **crate.bin** and **MLmodel** are present. If not, check the logs to see if there was an error.
156+
1. Open the **models** folder to verify that **crate.bin** and **MLmodel** are present. If not, check the logs to see if there was an error.
158157
1. On the toolbar at the top, select **+ Register model**.
159158

160159
:::image type="content" source="media/how-to-r-train-model/register-model.png" alt-text="Screenshot shows the Job section of studio with the Outputs section open.":::
161160

162-
1. For **Model type**, change the default from **MLflow** to **Unspecified type**.
161+
1. Don't use the **MLflow** model type, even though it's detected. Change **Model type** from the default **MLflow** to **Unspecified type**. Leaving it as **MLflow** will cause an error.
163162
1. For **Job output**, select **models**, the folder that contains the model.
164163
1. Select **Next**.
165-
1. Supply the name you wish to use for your model. Add **Description**, **Version**, and **Tags** if you wish.
164+
1. Supply the name you wish to use for your model. Add **Description**, **Version**, and **Tags** if you wish.
166165
1. Select **Next**.
167166
1. Review the information.
168167
1. Select **Register**.
169168

170-
At the top of the page, you'll see a confirmation that the model is registered. The confirmation looks similar to this:
169+
At the top of the page, you'll see a confirmation that the model is registered. The confirmation looks similar to this:
171170

172171
:::image type="content" source="media/how-to-r-train-model/registered.png" alt-text="Screenshot shows example of successful registration.":::
173172

0 commit comments

Comments
 (0)