Discretize continuous features with the Binning component
Feature discretization groups continuous data into a finite number of intervals, or bins. To do this, PAI provides the Binning and Data Conversion Module components. Use the Binning component to define bin boundaries for continuous features, and then use the Data Conversion Module to transform the original values into discrete bin indices.
Prerequisites
-
You have created a workspace. For more information, see Create and manage workspaces.
-
You have associated MaxCompute resources with your workspace. For more information, see Create and manage workspaces.
Procedure
Go to the Machine Learning Designer page.
Log on to the PAI console.
In the left-side navigation pane, click Workspaces. On the Workspaces page, click the name of the workspace that you want to manage.
In the left-side navigation pane, choose .
-
Create an empty pipeline and go to the pipeline page. For more information, see Create a Custom Pipeline.
Set the following parameters:
-
Pipeline Name: Enter Discretize Continuous Features by Using the Binning Component.
-
Description: Enter Use the Binning component provided by PAI to discretize continuous features.
-
Visibility: Select Visible to Me.
-
-
Build the pipeline.
-
From the component list on the left, drag the Read Table component under Source/Destination to the canvas.
-
From the component list on the left, drag the Binning and Data Conversion Module components under Financial Sector to the canvas.
-
Connect the components to form a pipeline as shown in the following figure.

-
-
Configure the component parameters.
-
Click the Read Table component on the canvas. In the right-side panel, configure the data source for the pipeline.
Tab
Parameter
Description
Table selection
Table Name
Enter pai_online_project.iris_data.
Partition
The Partition checkbox is unavailable because this table is not partitioned.
Field information
Source table field information
After you set the Table Name, the system automatically populates the Source table field information.
-
Click the Binning component on the canvas. In the right-side panel, configure the parameters. Configure only the following parameters and keep the default values for the rest.
Tab
Parameter
Description
Field Settings
Feature columns
Select the f1, f2, f3, and f4 columns.
Parameters
Number of bins
Set the value to 10. This discretizes the continuous features into 10 intervals.
Binning method
Valid values: Equal Frequency, Equal Width, and Auto Binning. To use Auto Binning, the data source must contain a label field and the scenario must be binary classification. This topic uses Equal Frequency as an example.
-
Click the Data Conversion Module component on the canvas. In the right-side panel, configure the parameters. Configure only the following parameters and keep the default values for the rest.
Tab
Parameter
Description
Field Settings
Columns not converted
Select the type column. This column is passed through without changes.
Data conversion type
Select Index.
-
-
Click the Run icon
at the top of the canvas. -
View the pipeline results.
-
After the pipeline is run, right-click the Data Conversion Module component on the canvas and choose from the shortcut menu to view the discretization results. The result table contains five columns: type, f1, f2, f3, and f4. The type column contains class labels, such as Iris-setosa, and the feature values in the f1 to f4 columns are converted to discrete integers.
-
Right-click the Binning component on the canvas and select Binning from the shortcut menu.
-
Click a feature name, such as f1, to view its binning details. The details dialog box has two tabs: List and Charts. The List tab displays a binning table and a toolbar with operations that include Save, Copy All, Merge, Split, Move Down, Move Up, Expand, Undo, Redo, View Constraints, and Export Bins and Constraints. The right-side Custom Binning panel allows you to customize bins using Specify Bins or Specify Boundaries. You can also set various constraints, such as ascending, descending, or Weight of Evidence (WOE) order.
-
Click the Charts tab to view the binning results in a chart.

-
Related documents
-
For more information about the algorithm components, see Binning and Data Conversion Module.
-
You can use Designer to perform other AI development tasks. For more information about Designer, see Overview of Designer.