You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/machine-learning/how-to-use-sweep-in-pipeline.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,40 +40,42 @@ The following Python SDK examples come from [Build pipeline with sweep node](htt
40
40
41
41
### Create a command component with hyperparameter inputs
42
42
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.
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:
>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
+
51
56
### Create the pipeline job with hyperparameter sweep step
52
57
53
58
# [Azure CLI](#tab/cli)
54
59
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`.
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`.
62
67
63
68
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.
>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).
73
75
74
76
## Check a pipeline job with sweep step in studio
75
77
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.
77
79
78
80
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.
0 commit comments