Skip to content

Commit 8a94a94

Browse files
authored
Merge pull request #5485 from cdpark/refresh-ml-designer-3
Feature 438779: Q&M: Azure ML Designer doc Freshness - batch 3
2 parents 295d5a2 + c4f4190 commit 8a94a94

File tree

6 files changed

+136
-120
lines changed

6 files changed

+136
-120
lines changed
Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Execute Python Script in the designer
2+
title: Execute Python Script in the Designer
33
titleSuffix: Azure Machine Learning
44
description: Learn how to use the Execute Python Script model in Azure Machine Learning designer to run custom operations written in Python.
55
services: machine-learning
@@ -8,7 +8,7 @@ ms.subservice: core
88
author: lgayhardt
99
ms.author: lagayhar
1010
ms.reviewer: keli19
11-
ms.date: 02/08/2023
11+
ms.date: 06/10/2025
1212
ms.topic: how-to
1313
ms.custom: UpdateFrequency5, designer, devx-track-python
1414
---
@@ -17,36 +17,38 @@ ms.custom: UpdateFrequency5, designer, devx-track-python
1717

1818
[!INCLUDE [v1 deprecation](../includes/sdk-v1-deprecation.md)]
1919

20-
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.
2121

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.
2323

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](../algorithm-module-reference/execute-python-script.md) component reference for a complete list of preinstalled packages.
2525

26-
![Execute Python input map](media/how-to-designer-python/execute-python-map.png)
26+
:::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.":::
2727

2828
> [!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).
3030
31-
## Execute Python written in the designer
31+
## Execute Python code in the designer
3232

3333
### Add the Execute Python Script component
3434

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.
3636

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**.
3838

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.
4042

41-
This article uses the **Automobile price data (Raw)** sample dataset.
43+
### Connect input datasets
4244

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.
4446

4547
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.
4648

4749
The right input port is reserved for zipped Python libraries.
4850

49-
![Connect datasets](media/how-to-designer-python/connect-dataset.png)
51+
:::image type="content" source="media/how-to-designer-python/connect-dataset.png" alt-text="Screenshot that shows how to connect the dataset nodes together.":::
5052

5153
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`.
5254

@@ -56,9 +58,9 @@ Input components are optional, since you can generate or import data directly in
5658

5759
The designer provides an initial entry point script for you to edit and enter your own Python code.
5860

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.
6062

61-
1. Select the **Execute Python Script** component.
63+
1. Double-click the **Execute Python Script** component.
6264

6365
1. In the pane that appears to the right of the canvas, select the **Python script** text box.
6466

@@ -71,18 +73,20 @@ In this example, you use Pandas to combine two of the automobile dataset columns
7173
dataframe1['Dollar/HP'] = dataframe1.price / dataframe1.horsepower
7274
return dataframe1
7375
```
76+
7477
Your pipeline should look like this image:
75-
76-
![Execute Python pipeline](media/how-to-designer-python/execute-python-pipeline.png)
78+
79+
:::image type="content" source="media/how-to-designer-python/execute-python-pipeline.png" alt-text="Screenshot that shows the Execute Python pipeline.":::
7780

7881
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.
7982

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+
8285
1. Submit the pipeline.
8386

8487
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.
8588

86-
## Next steps
89+
## Next step
8790

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

Comments
 (0)