Skip to content

Commit 3b6100f

Browse files
committed
Update deployment section, fix bad links, etc
1 parent c110a0b commit 3b6100f

File tree

1 file changed

+10
-55
lines changed

1 file changed

+10
-55
lines changed

articles/machine-learning/how-to-train-scikit-learn.md

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ description: Learn how Azure Machine Learning enables you to scale out a scikit-
55
services: machine-learning
66
ms.service: machine-learning
77
ms.subservice: core
8-
ms.author: larryfr
9-
author: blackmist
8+
ms.author: balapv
9+
author: balapv
10+
ms.reviewer: mopeakande
1011
ms.date: 09/22/2022
1112
ms.topic: how-to
1213
ms.custom: devx-track-python, sdkv2, event-tier1-build-2022
@@ -38,7 +39,6 @@ You can run this code in either an Azure Machine Learning compute instance, or y
3839

3940
- Create a Jupyter notebook server and run the code in the following sections.
4041
- [Install the Azure Machine Learning SDK (v2)](https://aka.ms/sdk-v2-install).
41-
- [Create a workspace configuration file](how-to-configure-environment.md#workspace).
4242

4343

4444
## Set up the experiment
@@ -47,12 +47,11 @@ This section sets up the training experiment by loading the required Python pack
4747

4848
### Connect to the workspace
4949

50-
First, you'll need to connect to your Azure Machine Learning workspace. The [AzureML workspace](concept-workspace.md) is the top-level resource for the service. It provides you with a centralized place to work with all the artifacts you create when you use Azure Machine Learning.
50+
First, you'll need to connect to your AzureML workspace. The [AzureML workspace](concept-workspace.md) is the top-level resource for the service. It provides you with a centralized place to work with all the artifacts you create when you use Azure Machine Learning.
5151

5252
We're using `DefaultAzureCredential` to get access to the workspace. This credential should be capable of handling most Azure SDK authentication scenarios.
5353

54-
<!-- M.A: link to "configure credential example" is missing (broken in notebook) -->
55-
If `DefaultAzureCredential` credential does not work for you, see [`azure-identity reference documentation`](/python/api/azure-identity/azure.identity?view=azure-python) or [`Set up authentication`](/azure/machine-learning/how-to-setup-authentication?tabs=sdk) for more available credentials.
54+
If `DefaultAzureCredential` credential does not work for you, see [`azure-identity reference documentation`](/python/api/azure-identity/azure.identity) or [`Set up authentication`](how-to-setup-authentication.md?tabs=sdk) for more available credentials.
5655

5756
[!notebook-python[](~/azureml-examples-v2samplesreorg/sdk/python/jobs/single-step/scikit-learn/train-hyperparameter-tune-deploy-with-sklearn/train-hyperparameter-tune-with-sklearn.ipynb?name=credential)]
5857

@@ -121,13 +120,13 @@ In this section, we'll cover how to run a training job, using a training script
121120

122121
### Prepare the training script
123122

124-
In this article, we've provided the [training script **train_iris.py**](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/ml-frameworks/scikit-learn/train-hyperparameter-tune-deploy-with-sklearn/train_iris.py) for you. In practice, you should be able to take any custom training script as is and run it with AzureML without having to modify your code.
123+
In this article, we've provided the training script *train_iris.py* to you. In practice, you should be able to take any custom training script as is and run it with AzureML without having to modify your code.
125124

126125
Notes:
127126

128127
The provided training script does the following:
129128
- shows how to log some metrics to your AzureML run;
130-
- downloads and extracts the training data using the `iris = datasets.load_iris()` function; and
129+
- downloads and extracts the training data using the `iris = datasets.load_iris()` function; and
131130
- trains a model, then saves and registers it.
132131

133132
To use and access your own data, see [how to train with datasets](v1/how-to-train-with-datasets.md) to make data available during training.
@@ -186,7 +185,7 @@ As the job is executed, it goes through the following stages:
186185

187186
## Tune model hyperparameters
188187

189-
Now that we've seen how to do a simple Scikit-learn training run using the SDK, let's see if we can further improve the accuracy of our model. We can optimize our model's hyperparameters using Azure Machine Learning's [`sweep`](python/api/azure-ai-ml/azure.ai.ml.sweep?view=azure-python-preview) capabilities.
188+
Now that we've seen how to do a simple Scikit-learn training run using the SDK, let's see if we can further improve the accuracy of our model. We can optimize our model's hyperparameters using Azure Machine Learning's [`sweep`](/python/api/azure-ai-ml/azure.ai.ml.sweep) capabilities.
190189

191190
To tune the model's hyperparameters, you'll define the parameter space in which to search during training. You'll do this by replacing some of the parameters (`kernel` and `penalty`) passed to the training job with special inputs from the `azure.ml.sweep` package.
192191

@@ -215,59 +214,15 @@ You can now register this model.
215214

216215
[!notebook-python[](~/azureml-examples-v2samplesreorg/sdk/python/jobs/single-step/scikit-learn/train-hyperparameter-tune-deploy-with-sklearn/train-hyperparameter-tune-with-sklearn.ipynb?name=register_model)]
217216

218-
<!--
219-
220-
you've trained the model, you can save and register it to your workspace. Model registration lets you store and version your models in your workspace to simplify [model management and deployment](concept-model-management-and-deployment.md).
221-
222-
Add the following code to your training script, train_iris.py, to save the model.
223-
224-
``` Python
225-
import joblib
226-
227-
joblib.dump(svm_model_linear, 'model.joblib')
228-
```
229-
230-
Register the model to your workspace with the following code. By specifying the parameters `model_framework`, `model_framework_version`, and `resource_configuration`, no-code model deployment becomes available. No-code model deployment allows you to directly deploy your model as a web service from the registered model, and the [`ResourceConfiguration`](/python/api/azureml-core/azureml.core.resource_configuration.resourceconfiguration) object defines the compute resource for the web service.
231-
232-
```Python
233-
from azureml.core import Model
234-
from azureml.core.resource_configuration import ResourceConfiguration
235-
236-
model = run.register_model(model_name='sklearn-iris',
237-
model_path='outputs/model.joblib',
238-
model_framework=Model.Framework.SCIKITLEARN,
239-
model_framework_version='0.19.1',
240-
resource_configuration=ResourceConfiguration(cpu=1, memory_in_gb=0.5))
241-
``` -->
242217

243218
## Deployment
244219

245-
The model you just registered can be deployed the exact same way as any other registered model in Azure ML. The deployment how-to
246-
contains a section on registering models, but you can skip directly to [creating a compute target](./v1/how-to-deploy-and-where.md#choose-a-compute-target) for deployment, since you already have a registered model.
247-
248-
### (Preview) No-code model deployment
249-
250-
Instead of the traditional deployment route, you can also use the no-code deployment feature (preview) for scikit-learn. No-code model deployment is supported for all built-in scikit-learn model types. By registering your model as shown above with the `model_framework`, `model_framework_version`, and `resource_configuration` parameters, you can simply use the [`deploy()`](/python/api/azureml-core/azureml.core.model%28class%29#deploy-workspace--name--models--inference-config-none--deployment-config-none--deployment-target-none--overwrite-false-) static function to deploy your model.
251-
252-
```python
253-
web_service = Model.deploy(ws, "scikit-learn-service", [model])
254-
```
255-
256-
NOTE: These dependencies are included in the pre-built scikit-learn inference container.
257-
258-
```yaml
259-
- azureml-defaults
260-
- inference-schema[numpy-support]
261-
- scikit-learn
262-
- numpy
263-
```
264-
265-
The full [how-to](./v1/how-to-deploy-and-where.md) covers deployment in Azure Machine Learning in greater depth.
220+
The model you just registered can be deployed the exact same way as any other registered model in Azure ML. For more information about deployment, see [Deploy and score a machine learning model with managed online endpoint using Python SDK v2](how-to-deploy-managed-online-endpoint-sdk-v2.md).
266221

267222

268223
## Next steps
269224

270-
In this article, you trained and registered a scikit-learn model, and learned about deployment options. See these other articles to learn more about Azure Machine Learning.
225+
In this article, you trained and registered a scikit-learn model, and you learned about deployment options. See these other articles to learn more about Azure Machine Learning.
271226

272227
* [Track run metrics during training](how-to-log-view-metrics.md)
273228
* [Tune hyperparameters](how-to-tune-hyperparameters.md)

0 commit comments

Comments
 (0)