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
In this article, you'll learn how to use the [Execute Python Script](../algorithm-module-reference/execute-python-script.md) component to add custom logic to the Azure Machine Learning designer. In this how-to, you use the Pandas library to do simple feature engineering.
20
+
This article explains how to use the [Execute Python Script](../algorithm-module-reference/execute-python-script.md) component to add custom logic to the Azure Machine Learning designer. In this guide, you use the Pandas library to do simple feature engineering.
21
21
22
-
You can use the in-built code editor to quickly add simple Python logic. You should use the zip file method to add more complex code, or to upload additional Python libraries.
22
+
You can use the in-built code editor to quickly add simple Python logic. You should use the zip file method to add more complex code, or to upload more Python libraries.
23
23
24
-
The default execution environment uses the Anacondas distribution of Python. See the [Execute Python Script component reference](../algorithm-module-reference/execute-python-script.md) page for a complete list of pre-installed packages.
24
+
The default execution environment uses the Anacondas distribution of Python. See the [Execute Python Script component reference](../algorithm-module-reference/execute-python-script.md) page for a complete list of preinstalled packages.
:::image type="content" source="media/how-to-designer-python/execute-python-map.png" alt-text="Diagram that shows the input map for Execute Python Script.":::
27
27
28
28
> [!IMPORTANT]
29
-
> If you do not see graphical elements mentioned in this document, such as buttons in studio or designer, you may not have the right level of permissions to the workspace. Please contact your Azure subscription administrator to verify that you have been granted the correct level of access. For more information, see [Manage users and roles](../how-to-assign-roles.md).
29
+
> If you don't see graphical elements mentioned in this document, such as buttons in studio or designer, you might not have the right level of permissions to the workspace. Contact your Azure subscription administrator to verify that you have been granted the correct level of access. For more information, see [Manage users and roles](../how-to-assign-roles.md).
30
30
31
-
## Execute Python written in the designer
31
+
## Execute Python code in the designer
32
32
33
33
### Add the Execute Python Script component
34
34
35
-
1.Find the **Execute Python Script** component in the designer palette. It can be found in the **Python Language** section.
35
+
1.Sign in to the [Azure Machine Learning studio](https://ml.azure.com), and select the workspace you want to use.
36
36
37
-
1.Drag and drop the component onto the pipeline canvas.
37
+
1.Select **Designer** from the sidebar menu. Under **Classic prebuilt**, choose **Create a new pipeline using classic prebuilt components**.
38
38
39
-
### Connect input datasets
39
+
1. To the left of the pipeline canvas, select **Component**.
40
+
41
+
1. In the **Python Language** section, find the **Execute Python Script** component. Drag and drop the component onto the pipeline canvas.
40
42
41
-
This article uses the **Automobile price data (Raw)** sample dataset.
43
+
### Connect input datasets
42
44
43
-
1. Drag and drop your dataset to the pipeline canvas.
45
+
1.Find the **Automobile price data (Raw)** sample dataset in the **Sample data** section. Drag and drop the dataset to the pipeline canvas.
44
46
45
47
1. Connect the output port of the dataset to the top-left input port of the **Execute Python Script** component. The designer exposes the input as a parameter to the entry point script.
46
48
47
49
The right input port is reserved for zipped Python libraries.
:::image type="content" source="media/how-to-designer-python/connect-dataset.png" alt-text="Screenshot that shows how to connect the dataset nodes together.":::
50
52
51
53
1. Carefully note the specific input port you use. The designer assigns the left input port to the variable `dataset1`, and the middle input port to `dataset2`.
52
54
@@ -56,9 +58,9 @@ Input components are optional, since you can generate or import data directly in
56
58
57
59
The designer provides an initial entry point script for you to edit and enter your own Python code.
58
60
59
-
In this example, you use Pandas to combine two of the automobile dataset columns - **Price** and **Horsepower** - to create a new column,**Dollars per horsepower**. This column represents how much you pay for each horsepower unit, which could become a useful information point to decide if a specific car is a good deal for its price.
61
+
In this example, you use Pandas to combine two of the automobile dataset columns, **Price** and **Horsepower**, to create a new column called**Dollars per horsepower**. This column represents how much you pay for each horsepower unit, which could become a useful information point to decide if a specific car is a good deal for its price.
60
62
61
-
1.Select the **Execute Python Script** component.
63
+
1.Double-click the **Execute Python Script** component.
62
64
63
65
1. In the pane that appears to the right of the canvas, select the **Python script** text box.
64
66
@@ -71,18 +73,20 @@ In this example, you use Pandas to combine two of the automobile dataset columns
:::image type="content" source="media/how-to-designer-python/execute-python-pipeline.png" alt-text="Screenshot that shows the Execute Python pipeline.":::
77
80
78
81
The entry point script must contain the function `azureml_main`. The function has two function parameters that map to the two input ports for the **Execute Python Script** component.
79
82
80
-
The return value must be a Pandas Dataframe. You can return at most two dataframes as component outputs.
81
-
83
+
The return value must be a Pandas dataframe. You can return at most two dataframes as component outputs.
84
+
82
85
1. Submit the pipeline.
83
86
84
87
Now you have a dataset, which has a new **Dollars/HP** feature. This new feature could help to train a car recommender. This example shows feature extraction and dimensionality reduction.
85
88
86
-
## Next steps
89
+
## Next step
87
90
88
-
Learn how to [import your own data](how-to-designer-import-data.md) in Azure Machine Learning designer.
91
+
> [!div class="nextstepaction"]
92
+
> [Import data into Azure Machine Learning designer](how-to-designer-import-data.md)
0 commit comments