Skip to content

Commit 0ab6896

Browse files
Minor edits.
1 parent d154bda commit 0ab6896

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

articles/machine-learning/how-to-use-mlflow-azure-databricks.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: MLflow Tracking for Azure Databricks ML experiments
2+
title: MLflow tracking for Azure Databricks ML experiments
33
titleSuffix: Azure Machine Learning
44
description: Set up MLflow with Azure Machine Learning to log metrics and artifacts from Azure Databricks ML experiments.
55
services: machine-learning
@@ -30,9 +30,9 @@ In this article, you learn:
3030

3131
- The `azureml-mlflow` package, which handles the connectivity with Azure Machine Learning, including authentication.
3232
- An [Azure Databricks workspace and cluster](/azure/databricks/scenarios/quickstart-create-databricks-workspace-portal).
33-
- [An Azure Machine Learning Workspace](quickstart-create-resources.md).
33+
- An [Azure Machine Learning Workspace](quickstart-create-resources.md).
3434

35-
See which [access permissions you need to perform your MLflow operations with your workspace](how-to-assign-roles.md#mlflow-operations).
35+
See which [access permissions](how-to-assign-roles.md#mlflow-operations) you need to perform your MLflow operations with your workspace.
3636

3737
### Example notebooks
3838

@@ -75,12 +75,12 @@ To link your Azure Databricks workspace to a new or existing Azure Machine Learn
7575

7676
:::image type="content" source="./media/how-to-use-mlflow-azure-databricks/link-workspaces.png" lightbox="./media/how-to-use-mlflow-azure-databricks/link-workspaces.png" alt-text="Screenshot shows the Link Azure Databricks and Azure Machine Learning workspaces option.":::
7777

78-
After you link your Azure Databricks workspace with your Azure Machine Learning workspace, MLflow Tracking is automatically tracked in the following places:
78+
After you link your Azure Databricks workspace with your Azure Machine Learning workspace, MLflow tracking is automatically tracked in the following places:
7979

8080
- The linked Azure Machine Learning workspace.
8181
- Your original Azure Databricks workspace.
8282

83-
You can use then MLflow in Azure Databricks in the same way that you're used to. The following example sets the experiment name as usual in Azure Databricks and start logging some parameters:
83+
You can use then MLflow in Azure Databricks in the same way that you're used to. The following example sets the experiment name as usual in Azure Databricks and start logging some parameters.
8484

8585
```python
8686
import mlflow
@@ -107,20 +107,20 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
107107

108108
#### Configure tracking URI
109109

110-
1. Get the tracking URI for your workspace:
110+
1. Get the tracking URI for your workspace.
111111

112112
# [Azure CLI](#tab/cli)
113113

114114
[!INCLUDE [cli v2](includes/machine-learning-cli-v2.md)]
115115

116-
1. Sign in and configure your workspace:
116+
1. Sign in and configure your workspace.
117117

118118
```bash
119119
az account set --subscription <subscription>
120120
az configure --defaults workspace=<workspace> group=<resource-group> location=<location>
121121
```
122122

123-
1. You can get the tracking URI using the `az ml workspace` command:
123+
1. You can get the tracking URI using the `az ml workspace` command.
124124

125125
```bash
126126
az ml workspace show --query mlflow_tracking_uri
@@ -130,9 +130,9 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
130130

131131
[!INCLUDE [sdk v2](includes/machine-learning-sdk-v2.md)]
132132

133-
You can get the Azure Machine Learning MLflow tracking URI using the [Azure Machine Learning SDK v2 for Python](concept-v2.md). Ensure you have the library `azure-ai-ml` installed in the compute you're using. The following sample gets the unique MLFLow tracking URI associated with your workspace.
133+
You can get the Azure Machine Learning MLflow tracking URI using the [Azure Machine Learning SDK v2 for Python](concept-v2.md). Ensure you have the library `azure-ai-ml` installed in the compute that you're using. The following sample gets the unique MLFLow tracking URI associated with your workspace.
134134
135-
1. Sign in into your workspace using the `MLClient`. The easier way to do that is by using the workspace config file:
135+
1. Sign in into your workspace using the `MLClient`. The easier way to do that is by using the workspace config file.
136136
137137
```python
138138
from azure.ai.ml import MLClient
@@ -148,7 +148,7 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
148148
> 1. Select the upper-right corner of the page > **Download config file**.
149149
> 1. Save the file `config.json` in the same directory where you are working.
150150
151-
Alternatively, you can use the subscription ID, resource group name, and workspace name to get it:
151+
Alternatively, you can use the subscription ID, resource group name, and workspace name to get it.
152152
153153
```python
154154
from azure.ai.ml import MLClient
@@ -167,15 +167,15 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
167167
> [!IMPORTANT]
168168
> `DefaultAzureCredential` tries to pull the credentials from the available context. If you want to specify credentials in a different way, for instance using the web browser in an interactive way, you can use `InteractiveBrowserCredential` or any other method available in [`azure.identity`](https://pypi.org/project/azure-identity/) package.
169169
170-
1. Get the Azure Machine Learning Tracking URI:
170+
1. Get the Azure Machine Learning Tracking URI.
171171
172172
```python
173173
mlflow_tracking_uri = ml_client.workspaces.get(ml_client.workspace_name).mlflow_tracking_uri
174174
```
175175
176176
# [Studio](#tab/studio)
177177
178-
Use the Azure Machine Learning portal to get the tracking URI:
178+
Use the Azure Machine Learning portal to get the tracking URI.
179179
180180
1. Open the [Azure Machine Learning studio portal](https://ml.azure.com) and sign in using your credentials.
181181
1. Select the name of your workspace to show the **Directory + Subscription + Workspace** page.
@@ -184,7 +184,7 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
184184
185185
# [Manually](#tab/manual)
186186
187-
You can construct the Azure Machine Learning Tracking URI using the subscription ID, region of where the resource is deployed, resource group name, and workspace name. The following code sample shows how:
187+
You can construct the Azure Machine Learning Tracking URI using the subscription ID, region of where the resource is deployed, resource group name, and workspace name. The following code sample shows how.
188188
189189
> [!WARNING]
190190
> If you're working in a private link-enabled workspace, the MLflow endpoint also uses a private link to communicate with Azure Machine Learning. Consequently, the tracking URI looks different than shown here. You need to get the tracking URI using the Azure Machine Learning SDK or CLI v2 on those cases.
@@ -198,11 +198,11 @@ Configure the MLflow tracking URI to point exclusively to Azure Machine Learning
198198
mlflow_tracking_uri = f"azureml://{region}.api.azureml.ms/mlflow/v1.0/subscriptions/{subscription_id}/resourceGroups/{resource_group}/providers/Microsoft.MachineLearningServices/workspaces/{workspace_name}"
199199
```
200200

201-
1. Configure the tracking URI:
201+
1. Configure the tracking URI.
202202

203203
# [Use MLflow SDK](#tab/mlflow)
204204

205-
Then the method [`set_tracking_uri()`](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.set_tracking_uri) points the MLflow tracking URI to that URI.
205+
The method [`set_tracking_uri()`](https://mlflow.org/docs/latest/python_api/mlflow.html#mlflow.set_tracking_uri) points the MLflow tracking URI to that URI.
206206

207207
```python
208208
import mlflow
@@ -235,7 +235,7 @@ After you configure tracking, configure how to authenticate to the associated wo
235235

236236
#### Experiment names in Azure Machine Learning
237237

238-
When you configure MLflow to exclusively track experiments in Azure Machine Learning workspace, the experiment naming convention has to follow the one used by Azure Machine Learning. In Azure Databricks, experiments are named with the path to where the experiment is saved, for instance `/Users/[email protected]/iris-classifier`. However, in Azure Machine Learning, you provide the experiment name directly. The same experiment would be named `iris-classifier` directly:
238+
When you configure MLflow to exclusively track experiments in Azure Machine Learning workspace, the experiment naming convention has to follow the one used by Azure Machine Learning. In Azure Databricks, experiments are named with the path to where the experiment is saved, for instance `/Users/[email protected]/iris-classifier`. However, in Azure Machine Learning, you provide the experiment name directly. The same experiment would be named `iris-classifier` directly.
239239

240240
```python
241241
mlflow.set_experiment(experiment_name="experiment-name")
@@ -249,7 +249,7 @@ After this configuration, you can use MLflow in Azure Databricks in the same way
249249
250250
After your model is trained, you can log it to the tracking server with the `mlflow.<model_flavor>.log_model()` method. `<model_flavor>` refers to the framework associated with the model. [Learn what model flavors are supported](https://mlflow.org/docs/latest/models.html#model-api).
251251
252-
In the following example, a model created with the Spark library MLLib is being registered:
252+
In the following example, a model created with the Spark library MLLib is being registered.
253253
254254
```python
255255
mlflow.spark.log_model(model, artifact_path = "model")
@@ -264,9 +264,9 @@ Models are logged inside of the run being tracked. That fact means that models a
264264
265265
## Registering models in the registry with MLflow
266266
267-
As opposite to tracking, model registries can't operate at the same time in Azure Databricks and Azure Machine Learning. They have to use either one or the other. By default, model registries use the Azure Databricks workspace. If you choose to [set MLflow Tracking to only track in your Azure Machine Learning workspace](#tracking-exclusively-on-azure-machine-learning-workspace), the model registry is the Azure Machine Learning workspace.
267+
As opposed to tracking, model registries can't operate at the same time in Azure Databricks and Azure Machine Learning. They have to use either one or the other. By default, model registries use the Azure Databricks workspace. If you choose to [set MLflow tracking to only track in your Azure Machine Learning workspace](#tracking-exclusively-on-azure-machine-learning-workspace), the model registry is the Azure Machine Learning workspace.
268268

269-
If you use the default configuration, the following code logs a model inside the corresponding runs of both Azure Databricks and Azure Machine Learning, but it registers it only on Azure Databricks:
269+
If you use the default configuration, the following code logs a model inside the corresponding runs of both Azure Databricks and Azure Machine Learning, but it registers it only on Azure Databricks.
270270

271271
```python
272272
mlflow.spark.log_model(model, artifact_path = "model",
@@ -278,7 +278,7 @@ mlflow.spark.log_model(model, artifact_path = "model",
278278

279279
### Using Azure Machine Learning Registry with MLflow
280280

281-
If you want to use Azure Machine Learning Model Registry instead of Azure Databricks, we recommend that you [set MLflow Tracking to only track in your Azure Machine Learning workspace](#tracking-exclusively-on-azure-machine-learning-workspace). This approach removes the ambiguity of where models are being registered and simplifies the configuration.
281+
If you want to use Azure Machine Learning Model Registry instead of Azure Databricks, we recommend that you [set MLflow tracking to only track in your Azure Machine Learning workspace](#tracking-exclusively-on-azure-machine-learning-workspace). This approach removes the ambiguity of where models are being registered and simplifies the configuration.
282282

283283
If you want to continue using the dual-tracking capabilities but register models in Azure Machine Learning, you can instruct MLflow to use Azure Machine Learning for model registries by configuring the MLflow Model Registry URI. This URI has the same format and value that the MLflow that tracks URI.
284284

@@ -287,7 +287,7 @@ mlflow.set_registry_uri(azureml_mlflow_uri)
287287
```
288288

289289
> [!NOTE]
290-
> The value of `azureml_mlflow_uri` was obtained in the same way as described in [Set MLflow Tracking to only track in your Azure Machine Learning workspace](#tracking-exclusively-on-azure-machine-learning-workspace).
290+
> The value of `azureml_mlflow_uri` was obtained in the same way as described in [Set MLflow tracking to only track in your Azure Machine Learning workspace](#tracking-exclusively-on-azure-machine-learning-workspace).
291291

292292
For a complete example of this scenario, see [Training models in Azure Databricks and deploying them on Azure Machine Learning](https://github.com/Azure/azureml-examples/blob/main/sdk/python/using-mlflow/deploy/track_with_databricks_deploy_aml.ipynb).
293293

@@ -326,7 +326,7 @@ pyfunc_udf = mlflow.pyfunc.spark_udf(spark, model_uri)
326326
327327
For more ways to reference models from the registry, see [Loading models from registry](how-to-manage-models-mlflow.md#loading-models-from-registry).
328328
329-
After the model is loaded, you can use to score new data:
329+
After the model is loaded, you can use this command to score new data.
330330
331331
```python
332332
#Load Scoring Data into Spark Dataframe
@@ -344,7 +344,7 @@ display(preds)
344344
345345
If you want to keep your Azure Databricks workspace, but no longer need the Azure Machine Learning workspace, you can delete the Azure Machine Learning workspace. This action results in unlinking your Azure Databricks workspace and the Azure Machine Learning workspace.
346346
347-
If you don't plan to use the logged metrics and artifacts in your workspace, delete the resource group that contains the storage account and workspace:
347+
If you don't plan to use the logged metrics and artifacts in your workspace, delete the resource group that contains the storage account and workspace.
348348

349349
1. In the Azure portal, search for *Resource groups*. Under **services**, select **Resource groups**.
350350
1. In the **Resource groups** list, find and select the resource group that you created to open it.

0 commit comments

Comments
 (0)