The Lorenz Curve component plots the cumulative distribution of a dataset to reveal inequality. Originally used in economics to visualize income and wealth distribution, it is equally applicable in machine learning for evaluating prediction fairness and detecting bias in resource allocation. The curve plots the cumulative share of a measured value (y-axis) against the cumulative share of the population (x-axis), sorted from lowest to highest.
Configure the component
Method 1: configure in Machine Learning Designer
On the pipeline details page in Machine Learning Designer, add the Lorenz Curve component and configure the following parameters.
Fields Setting tab
| Parameter | Description |
|---|---|
| Select Fields | The feature column to analyze. Select a numeric column containing values such as income, wealth, or prediction score. |
Parameters Setting tab
| Parameter | Description |
|---|---|
| Quantile | The number of equal-probability intervals used to plot the curve. A higher value produces a finer-grained curve. |
Tuning tab
| Parameter | Description |
|---|---|
| Computing Cores | The number of cores used for computation. Must be a positive integer. |
| Memory Size per Core (Unit: MB) | The memory allocated to each core, in MB. |
Method 2: use PAI commands
Pass parameters directly using Platform for AI (PAI) commands. Use the SQL Script component to run the command. For details, see Scenario 4: Execute PAI commands within the SQL script component.
PAI -name LorenzCurve
-project algo_public
-DinputTableName=maple_test_lorenz_basic10_input
-DcolName=col0
-DoutputTableName=maple_test_lorenz_basic10_output
-DcoreNum=20
-DmemSizePerCore=110;| Parameter | Required | Default | Description |
|---|---|---|---|
inputTableName | Yes | — | The name of the input table. |
outputTableName | Yes | — | The name of the output table. |
colName | No | — | The columns to analyze. Separate multiple column names with commas (,). |
N | No | 100 | The number of quantile intervals. A higher value produces a finer-grained curve. |
inputTablePartitions | No | — | The partitions to read from the input table. Supported formats: partition_name=value and name1=value1/name2=value2 (multi-level). Separate multiple partitions with commas (,). Example: name1=value1,value2. |
lifecycle | No | 28 | The retention period of the output table, in days. Must be an integer. |
coreNum | No | System-determined | The number of computing cores. Used together with memSizePerCore. Must be a positive integer. The system calculates the instance count based on the volume of input data. |
memSizePerCore | No | System-determined | The memory size per core, in MB. Must be a positive integer. Recommended values: (1024, 64 × 1024). |
Example
This example uses an 11-row dataset with values 0–10 to show how the component produces a quantile distribution table.
Step 1: Prepare the input data
| col0:double |
|---|
| 4 |
| 7 |
| 2 |
| 8 |
| 6 |
| 3 |
| 9 |
| 5 |
| 0 |
| 1 |
| 10 |
Step 2: Run the PAI command
PAI -name LorenzCurve
-project algo_public
-DinputTableName=maple_test_lorenz_basic10_input
-DcolName=col0
-DoutputTableName=maple_test_lorenz_basic10_output
-DcoreNum=20
-DmemSizePerCore=110;Step 3: Review the output
The output table contains two columns: quantile (the population percentile, 0–100) and col0 (the cumulative share of the total value held by that percentile group). A sample of the output:
| quantile | col0 |
|---|---|
| 0 | 0 |
| 1 | 0.01818181818181818 |
| 10 | 0.01818181818181818 |
| 11 | 0.05454545454545454 |
| ... | ... |
| 85 | 0.8181818181818182 |
| 90 | 1 |
| 100 | 1 |
Interpreting the output: The col0 value at a given quantile represents the cumulative share of the total held by the bottom X% of the population. For example, at quantile 85, the bottom 85% of values account for approximately 81.8% of the total. At quantile 90, the cumulative share reaches 1 (100%), meaning all values are concentrated within the bottom 90%.