Skip to content

Commit aa69b13

Browse files
committed
Edit content
1 parent d459647 commit aa69b13

File tree

1 file changed

+33
-28
lines changed

1 file changed

+33
-28
lines changed

articles/machine-learning/how-to-monitor-model-performance.md

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,23 @@ You can use the Azure CLI, the Python SDK, or the studio for an out-of-box setup
8282

8383
# [Azure CLI](#tab/azure-cli)
8484

85-
Azure Machine Learning model monitoring uses `az ml schedule` to schedule a monitoring job. You can create the out-of-box model monitor with the following CLI command and YAML definition:
85+
In the Azure CLI, you use `az ml schedule` to schedule a monitoring job.
8686

87-
```azurecli
88-
az ml schedule create -f ./out-of-box-monitoring.yaml
89-
```
87+
1. Create a monitoring definition in a YAML file. For a sample out-of-box definition, see the following YAML code, which is also available in the [azureml-examples repository](https://github.com/Azure/azureml-examples/blob/main/cli/monitoring/out-of-box-monitoring.yaml).
88+
89+
Before you use this definition, adjust the values to fit your environment. For `endpoint_deployment_id`, use a value in the format `azureml:<endpoint-name>:<model-name>`.
90+
91+
:::code language="yaml" source="~/azureml-examples-main/cli/monitoring/out-of-box-monitoring.yaml":::
9092

91-
The following YAML contains the definition for the out-of-box model monitoring.
93+
1. Run the following command to create the model:
9294

93-
:::code language="yaml" source="~/azureml-examples-main/cli/monitoring/out-of-box-monitoring.yaml":::
95+
```azurecli
96+
az ml schedule create -f ./out-of-box-monitoring.yaml
97+
```
9498

9599
# [Python SDK](#tab/python)
96100

97-
You can use the following code to set up the out-of-box model monitoring:
101+
To set up the out-of-box model monitoring, use code that's similar to the following sample. For `endpoint_deployment_id`, use a value in the format `azureml:<endpoint-name>:<model-name>`.
98102

99103
```python
100104
from azure.identity import DefaultAzureCredential
@@ -109,82 +113,83 @@ from azure.ai.ml.entities import (
109113
ServerlessSparkCompute
110114
)
111115

112-
# get a handle to the workspace
116+
# Get a handle to the workspace.
113117
ml_client = MLClient(
114118
DefaultAzureCredential(),
115119
subscription_id="subscription_id",
116120
resource_group_name="resource_group_name",
117121
workspace_name="workspace_name",
118122
)
119123

120-
# create the compute
124+
# Create the compute instance.
121125
spark_compute = ServerlessSparkCompute(
122126
instance_type="standard_e4s_v3",
123127
runtime_version="3.3"
124128
)
125129

126-
# specify your online endpoint deployment
130+
# Specify your online endpoint deployment.
127131
monitoring_target = MonitoringTarget(
128132
ml_task="classification",
129133
endpoint_deployment_id="azureml:credit-default:main"
130134
)
131135

132136

133-
# create alert notification object
137+
# Create an alert notification object.
134138
alert_notification = AlertNotification(
135139
136140
)
137141

138-
# create the monitor definition
142+
# Create the monitor definition.
139143
monitor_definition = MonitorDefinition(
140144
compute=spark_compute,
141145
monitoring_target=monitoring_target,
142146
alert_notification=alert_notification
143147
)
144148

145-
# specify the schedule frequency
149+
# Specify the schedule frequency.
146150
recurrence_trigger = RecurrenceTrigger(
147151
frequency="day",
148152
interval=1,
149153
schedule=RecurrencePattern(hours=3, minutes=15)
150154
)
151155

152-
# create the monitor
156+
# Create the monitoring schedule.
153157
model_monitor = MonitorSchedule(
154158
name="credit_default_monitor_basic",
155159
trigger=recurrence_trigger,
156160
create_monitor=monitor_definition
157161
)
158162

163+
# Schedule the monitoring job.
159164
poller = ml_client.schedules.begin_create_or_update(model_monitor)
160165
created_monitor = poller.result()
161166
```
162167

163168
# [Studio](#tab/azure-studio)
164169

165-
1. Navigate to [Azure Machine Learning studio](https://ml.azure.com).
170+
1. Go to [Azure Machine Learning studio](https://ml.azure.com).
166171
1. Go to your workspace.
167-
1. Select **Monitoring** from the **Manage** section
172+
1. Under **Manage**, select **Monitoring**.
168173
1. Select **Add**.
169174

170175
:::image type="content" source="media/how-to-monitor-models/add-model-monitoring.png" alt-text="Screenshot showing how to add model monitoring." lightbox="media/how-to-monitor-models/add-model-monitoring.png":::
171176

172-
1. On the **Basic settings** page, use **(Optional) Select model** to choose the model to monitor.
173-
1. The **(Optional) Select deployment with data collection enabled** dropdown list should be automatically populated if the model is deployed to an Azure Machine Learning online endpoint. Select the deployment from the dropdown list.
174-
1. Select the training data to use as the comparison reference in the **(Optional) Select training data** box.
175-
1. Enter a name for the monitoring in **Monitor name** or keep the default name.
176-
1. Notice that the virtual machine size is already selected for you.
177-
1. Select your **Time zone**.
178-
1. Select **Recurrence** or **Cron expression** scheduling.
179-
1. For **Recurrence** scheduling, specify the repeat frequency, day, and time. For **Cron expression** scheduling, enter a cron expression for monitoring run.
177+
1. On the Basic settings page, under **(Optional) Select model**, select the model that you want to monitor.
178+
1. In the **(Optional) Select deployment with data collection enabled** list, select the deployment that you want to monitor. This list should be automatically populated if the model is deployed to an Azure Machine Learning online endpoint.
179+
1. Under **(Optional) Select training data**, select the training data to use as the comparison reference.
180+
1. Under **Monitor name**, enter a name for the monitoring, or keep the default name.
181+
1. Under **Virtual machine size**, use the default size.
182+
1. Under **Time zone**, select your time zone.
183+
1. For scheduling, select **Recurrence** or **Cron expression**.
184+
1. For recurrence scheduling, specify the repeat frequency, day, and time. For cron expression scheduling, enter a cron expression for a monitoring run.
180185

181186
:::image type="content" source="media/how-to-monitor-models/model-monitoring-basic-setup.png" alt-text="Screenshot of basic settings page for model monitoring." lightbox="media/how-to-monitor-models/model-monitoring-basic-setup.png":::
182187

183188
1. Select **Next** to go to the **Advanced settings** section.
184-
1. Select **Next** on the **Configure data asset** page to keep the default datasets.
185-
1. Select **Next** to go to the **Select monitoring signals** page.
186-
1. Select **Next** to go to the **Notifications** page. Add your email to receive email notifications.
187-
1. Review your monitoring details and select **Create** to create the monitor.
189+
1. On the Configure data asset page, select **Next** to keep the default datasets.
190+
1. On the Select monitoring signals page, select **Next**.
191+
1. On the Notifications page, enter the email address that you want to use to receive notifications, and then select **Next**.
192+
1. On the Review monitoring details page, check the settings, and then select **Create**.
188193

189194
---
190195

0 commit comments

Comments
 (0)