The Empirical Probability Density Chart component estimates and visualizes the probability density distribution of a dataset using Kernel Density Estimation (KDE). Use it for exploratory data analysis (EDA) and distribution hypothesis testing.
How it works
KDE builds on the familiar concept of a histogram—instead of counting data points within fixed bins, it places a smooth Gaussian curve over each data point and sums the contributions across the dataset. The result is a continuous smooth curve that reflects the underlying distribution without depending on arbitrary bin boundaries.
The output table records density values at evenly spaced interpolated points (not the original data points), giving you the smooth curve ready to plot.
Configure the component
Method 1: Configure the component on the pipeline page
Add an Empirical Probability Density Chart component on the pipeline page and configure the following parameters:
| Category | Parameter | Description |
|---|---|---|
| Fields Setting | Input Columns | The input columns. Only BIGINT and DOUBLE columns are supported. |
| Label Column | (Optional) The label column. When set, results are grouped by label value. For example, a label column with values 0 and 1 produces two separate density curves—one per group. Use this to compare distributions across categories. |
|
| Parameter Settings | Number of Calculation Intervals | The number of evenly spaced points at which the density is evaluated. A higher value produces a smoother, more detailed curve. The range is determined by the value range of each input column. |
| Tuning | Core Number | The number of cores to use. Must be a positive integer. |
| Memory Size | The memory allocated to each core. Valid values: 1–65536. Unit: MB. |
Method 2: Use PAI commands
Run the component as a PAI command from an SQL script component. For more information about SQL script components, see SQL script.
PAI -name empirical_pdf
-project algo_public
-DinputTableName="test_data"
-DoutputTableName="test_epdf_out"
-DfeatureColNames="col0,col1,col2"
-DinputTablePartitions="ds='20160101'"
-Dlifecycle=1
-DintervalNum=100
| Parameter | Required | Default | Description |
|---|---|---|---|
inputTableName |
Yes | — | The name of the input table. |
outputTableName |
Yes | — | The name of the output table. |
featureColNames |
Yes | — | The feature columns to analyze, comma-separated. |
labelColName |
No | — | The label column for grouping. When set, the output includes one density curve per distinct label value. |
inputTablePartitions |
No | — | The partitions to read from the input table. Supported formats: partition_name=value for a single partition, and name1=value1/name2=value2 for multi-level partitions. To specify multiple partitions, separate them with commas—for example, name1=value1,name2=value2. |
intervalNum |
No | — | The number of evaluation points. Valid values: [1, 1E14). |
lifecycle |
No | — | The lifecycle of the output table. |
coreNum |
No | System-determined | The number of cores. Must be a positive integer. |
memSizePerCore |
No | System-determined | The memory per core. Valid values: 1–65536. Unit: MB. |
Example
This example creates a small test dataset with five values and runs KDE on the col1 column.
-
Add an SQL script component. Deselect Use Script Mode and Whether the system adds a create table statement, then enter the following SQL:
drop table if exists epdf_test; create table epdf_test as select * from ( select 1.0 as col1 union all select 2.0 as col1 union all select 3.0 as col1 union all select 4.0 as col1 union all select 5.0 as col1 ) tmp; -
Add a second SQL script component. Deselect Use Script Mode and Whether the system adds a create table statement, enter the following PAI command, and connect this component to the one from step 1:
drop table if exists ${o1}; PAI -name empirical_pdf -project algo_public -DinputTableName=epdf_test -DoutputTableName=${o1} -DfeatureColNames=col1; -
Click the
icon in the upper left corner to run the pipeline. -
Right-click the SQL script component from step 2 and choose View Data > SQL Script Output to inspect the results.
The output table has the following columns:
Column Type Description colNamestring The input column name. labelstring The label value. Empty when no label column is specified. xdouble An interpolated x-axis position on the density curve. These are evenly spaced evaluation points, not the original data values. pdfdouble The estimated probability density function (PDF) value at position x.A partial sample of the output:
colname label x pdf col1 1.0 0.12775155176809325 col1 1.0404050505050506 0.1304256933829622 col1 1.0808101010101012 0.13306325897429525 col1 … … col1 3.181872727272733 0.19773188285349683 col1 … … col1 5.00010000000001 0.13799472213247665 Each row represents one evaluation point on the smooth curve. Plot
xon the horizontal axis andpdfon the vertical axis to visualize the distribution.