Skip to content

Commit 4a39449

Browse files
committed
touchup
1 parent 74b4877 commit 4a39449

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

articles/machine-learning/how-to-use-sweep-in-pipeline.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,42 @@ The following Python SDK examples come from [Build pipeline with sweep node](htt
4040

4141
### Create a command component with hyperparameter inputs
4242

43-
The Azure Machine Learning pipeline must have a command component with hyperparameter inputs. The following *train.yml* file defines a `trial` component that has the `c_value`, `kernel`, and `coef` hyperparameter inputs and runs the source code in the *./train-src* folder.
43+
The Azure Machine Learning pipeline must have a command component with hyperparameter inputs. The following *train.yml* file defines a `trial` component that has the `c_value`, `kernel`, and `coef` hyperparameter inputs and runs the source code that's located in the *./train-src* folder.
4444

4545
:::code language="yaml" source="~/azureml-examples-main/cli/jobs/pipelines-with-components/pipeline_with_hyperparameter_sweep/train.yml" highlight="11-16,23-25,60":::
4646

47-
In this example, the source code is a single *train.py* file. This code executes in every trial of the sweep job. The following example shows the trial component source code:
47+
### Create the trial component source code
48+
49+
The example source code for this example is a single *train.py* file. This code executes in every trial of the sweep job. The following code shows the trial component source code:
4850

4951
:::code language="python" source="~/azureml-examples-main/cli/jobs/pipelines-with-components/pipeline_with_hyperparameter_sweep/train-src/train.py" highlight="15":::
5052

53+
>[!NOTE]
54+
>Make sure to log the metrics in the trial component source code with exactly the same name as the `primary_metric` value in the pipeline file. This example uses `mlflow.autolog()`, which is the recommended way to track machine learning experiments. For more information about MLflow, see [Track ML experiments and models with MLflow](./how-to-use-mlflow-cli-runs.md).
55+
5156
### Create the pipeline job with hyperparameter sweep step
5257

5358
# [Azure CLI](#tab/cli)
5459

55-
Given the command component defined in *train.yml*, the following code shows a two-step `train` and `predict` pipeline definition file with the hyperparameter tuning `sweep_step` highlighted. In the `sweep_step`, the required step type is `sweep`, and the `c_value`, `kernel`, and `coef` hyperparameter inputs for the `trial` component are added to the `search_space`.
60+
Given the command component defined in *train.yml*, the following code creates a two-step `train` and `predict` pipeline definition file. In the `sweep_step`, the required step type is `sweep`, and the `c_value`, `kernel`, and `coef` hyperparameter inputs for the `trial` component are added to the `search_space`. The following example highlights the hyperparameter tuning `sweep_step`.
5661

57-
:::code language="yaml" source="~/azureml-examples-main/cli/jobs/pipelines-with-components/pipeline_with_hyperparameter_sweep/pipeline.yml" highlight="7-48":::
62+
:::code language="yaml" source="~/azureml-examples-main/cli/jobs/pipelines-with-components/pipeline_with_hyperparameter_sweep/pipeline.yml" highlight="8-48":::
5863

5964
# [Python SDK](#tab/python)
6065

6166
In the v2 SDK, you can enable hyperparameter tuning for any command component by calling the `.sweep()` method. The following pipeline definition shows how to enable sweep for `train_model`.
6267

6368
The example first loads the `train_component_func` defined in the *train.yml* file. To create the `train_model`, the code adds the `c_value`, `kernel`, and `coef0` hyperparameters into the search space. The `sweep_step` defines the `primary_metric`, `sampling_algorithm`, and other parameters.
6469

65-
[!notebook-python[] (~/azureml-examples-main/sdk/python/jobs/pipelines/1c_pipeline_with_hyperparameter_sweep/pipeline_with_hyperparameter_sweep.ipynb?name=enable-sweep)]
70+
[!Notebook-python[] (~/azureml-examples-main/sdk/python/jobs/pipelines/1c_pipeline_with_hyperparameter_sweep/pipeline_with_hyperparameter_sweep.ipynb?name=enable-sweep)]
6671

6772
---
6873

69-
>[!NOTE]
70-
>Make sure to log the metrics in the trial component source code with exactly the same names as the `primary_metric` value in the pipeline file. This example uses `mlflow.autolog()`, which is the recommended way to track machine learning experiments. For more information about MLflow, see [Track ML experiments and models with MLflow](./how-to-use-mlflow-cli-runs.md).
71-
72-
After you submit this pipeline job, Azure Machine Learning runs the `trial` component multiple times to sweep over hyperparameters, based on the search space and limits you defined in the `sweep_step`. See [CLI (v2) sweep job YAML schema](reference-yaml-job-sweep.md) for the full sweep job schema.
74+
After you submit this pipeline job, Azure Machine Learning runs the `trial` component multiple times to sweep over hyperparameters, based on the search space and limits you defined in the `sweep_step`. For the full sweep job schema, see [CLI (v2) sweep job YAML schema](reference-yaml-job-sweep.md).
7375

7476
## Check a pipeline job with sweep step in studio
7577

76-
After you submit a pipeline job, the SDK or CLI widget gives you a web URL link to the pipeline graph view in the Azure Machine Learning studio UI.
78+
After you submit a pipeline job, the SDK or CLI widget gives you a web URL link to the pipeline graph in the Azure Machine Learning studio UI.
7779

7880
To details of the sweep step, double click the sweep step in the pipeline graph, select the **Child jobs** tab in the details panel, and then select the child job.
7981

41 Bytes
Loading

0 commit comments

Comments
 (0)