This document introduces the usage of feature engineering module operators, including binarization, principal component analysis, Cartesian product, discrete cosine transform, row normalization, column normalization, singular value decomposition, feature hashing, one-hot encoding, Array processing, Map processing, feature importance, feature selection, and many others.
Feature engineering generally refers to the process of transforming raw data into features that better represent the essence of the problem, so that using these features in predictive models can improve the model's prediction accuracy on unseen data. After completing data input, feature engineering operators can be used to further process the input data. The following sections provide a detailed introduction to these operators.
Feature engineering operators | Introduction |
|---|---|
Convert numerical features into binary features 0 or 1 to categorize quantitative features as "yes" or "no" and remove redundant information | |
Reduce data dimensionality by mapping high-dimensional features to a low-dimensional orthogonal space, retaining most of the original information | |
Calculate the Cartesian product of two sets of numerical features to generate combinations between features | |
A digital signal processing technique that converts time-domain signals into frequency-domain representations, mainly used for data compression and feature extraction | |
Normalize each row of data so that all rows are on the same scale | |
Standardize, apply min-max scaling, or apply max-abs scaling to the specified columns to make data with different scales or units comparable | |
Simplify numerical data by selecting the largest singular values to project the data into a low-dimensional space | |
Map high-dimensional features to a fixed-dimensional vector space using a hash function, suitable for feature compression of large-scale sparse data | |
Convert discrete categorical variables into N binary features (0/1), with each new feature corresponding to a possible value of the original feature | |
Perform batch operations on array-type fields, supporting automatic detection of array formats and optimization of storage structure | |
Operate on columns containing key-value pair structures, mainly used for parsing and processing mapping-type data such as JSON and dictionaries | |
Calculate the weight of each feature for the target variable to help identify the most influential features, supporting seven computation methods | |
Select key features based on feature importance weights, supports three selection methods: by threshold, by Top K, and by Top percentage |
Binarization converts numerical features into binary features, 0 or 1. In the field of data mining, the purpose of binarization is to divide quantitative features into "yes or no" categories to eliminate redundant information.
Usage example:
Example 1: Customer value segmentation
Example 2: Financial risk assessment
Parameter description:
Parameters | Description |
|---|---|
Selection type | Select field range: |
Invert selection | Disabled by default. If enabled, the logic is reversed (the original rule |
Replace original column | Enabled by default. When enabled, the original field is replaced directly; otherwise, a new column is added. |
Output column suffix | Suffix for the new column (applies when "Replace original column" is disabled). |
Binary classification threshold | The default value is 0.5. The cutoff for numeric values: values greater than or equal to the threshold are converted to 1; otherwise, they are converted to 0. |
Principal component analysis (PCA) is a dimensionality reduction algorithm that maps high-dimensional features to a low-dimensional orthogonal space (principal components), reducing the number of features while retaining most of the original information. This function only supports operations on attributes that are numeric and have the role "regular". The output results are usually used as input for other analytical models.
tip
regular: Refers to basic data attributes used as standard input features for model training or analysis. These attributes are the core basis for model computation and learning, and do not serve special functions (such as serving as a sample ID or being used only as filtering criteria for data selection).
Usage example:
Example 1: Dimensionality reduction for customer credit scoring
Example 2: Visualization of product sales data
Parameter description:
Parameter | Description |
|---|---|
Feature columns | Numeric feature columns participating in PCA analysis; multiple columns can be selected. |
Dimensionality reduction method | Determine the dimensionality reduction method and the degree of reduction.
|
The Cartesian product refers to the Cartesian product of two sets X and Y, also known as the direct product, denoted as X × Y. Each ordered pair consists of a member from X and a member from Y.
Usage example:
Example 1: Generating product specification combinations
Original data table (products)
product_id | length | width | height |
|---|---|---|---|
1001 | 30 | 20 | 10 |
1002 | 40 | 25 | 15 |
Parameter settings:
lengthwidthOutput result:
product_id | length | width | height | interaction result |
|---|---|---|---|---|
1001 | 30 | 20 | 10 | 600 |
1002 | 40 | 25 | 15 | 1000 |
Parameter description:
Parameter | Description |
|---|---|
Selected columns for left operand | The first dimension columns of the Cartesian product; must be numeric and multiple columns can be selected. |
Selected columns for right operand | The second dimension columns of the Cartesian product; must be numeric and multiple columns can be selected. |
warning
There must be no duplicate fields between "Selected columns for left operand" and "Selected columns for right operand".
The discrete cosine transform (DCT) is a digital signal processing technique that converts time-domain signals into frequency-domain representations. This function uses a mathematical transformation to convert a real-valued sequence of length N into a frequency-domain coefficient sequence of the same length, mainly used for data compression and feature extraction.
tip
Core concept explanation:
Usage example:
Example 1: Audio signal feature extraction
Business scenario: Extracting frequency-domain features from audio waveform signals for speech recognition or compression.
Parameter settings:
audio_waveform (audio sample point sequence)false (forward DCT, time domain → frequency domain)feature_transformed (frequency-domain coefficients are automatically generated)Output effect:
audio_waveform (original signal) | feature_transformed (DCT coefficients) |
|---|---|
0.1 | 12.8 |
0.5 | 5.3 |
-0.2 | -1.2 |
... | ... |
Parameter description:
Parameter | Description |
|---|---|
Feature columns | Features used for training; multiple selections are allowed. |
Inverse | Used to control the transformation direction: |
Row normalization is a data standardization method that normalizes each row of data, ensuring that all rows are comparable on the same scale, which facilitates subsequent comprehensive analysis and modeling.
Usage example:
Example 1: Normalizing user behavior data
Original data:
User ID | Click count | Browsing duration (seconds) | Purchase amount (CNY) |
|---|---|---|---|
1001 | 20 | 300 | 500 |
1002 | 50 | 600 | 200 |
Parameter settings:
Result after processing:
User ID | feature_transformed (array format) |
|---|---|
1001 | [0.036, 0.539, 0.842] |
1002 | [0.078, 0.937, 0.312] |
Parameter description:
Parameter | Description |
|---|---|
Feature columns | Features used for training; here refers to the numeric fields that need to be normalized. Multiple selections are allowed. |
p |
|
Column normalization is a data preprocessing method that scales specified columns to make data with different units comparable. It supports three scaling methods: standardization (standard), min-max scaling (min-max), and max-abs scaling (max-abs). In-place modification is not supported for now. The generated result is a single array column. To split it into separate columns, add a vector decomposer operator after this operator.
tip
inplace modification: Refers to modifying the original data object directly without creating a new copy. Simply put, when performing an operation on data (such as modifying values, deleting elements, converting formats, and so on), if using the inplace method, the operation is applied directly to the original data. After the operation, the original data becomes the modified version, and no additional data object is created to store the result.
Usage example:
Example 1: Standardization (standard) scaling
Calculation formula: (x - mean of 5000) / standard deviation of 2449.49
User ID | Original sales amount | Standardization result (std_scale) |
|---|---|---|
1001 | 2000 | -1.2247 |
1002 | 5000 | 0 |
1003 | 8000 | 1.2247 |
Example 2: Min-max scaling
Calculation formula: (x - min of 18) / (max of 52 - min of 18)
User ID | Original age | Min-max result (std_scale) |
|---|---|---|
1001 | 18 | 0.0 |
1002 | 35 | 0.5 |
1003 | 52 | 1.0 |
Example 3: Max-abs scaling example
Calculation formula: x / max(abs(800), abs(-400))
User ID | Original profit | Max-abs result (std_scale) |
|---|---|---|
1001 | -400 | -0.5 |
1002 | 200 | 0.25 |
1003 | 800 | 1.0 |
Parameter description:
Parameter | Description |
|---|---|
Feature columns | Features used for training; here refers to the numeric columns that need to be normalized. Multiple selections are allowed. |
Scaling type | Select the column normalization method.
|
Use standard deviation | Enabled by default. For the standard method only; whether to use the standard deviation. |
Use mean | Enabled by default. For the standard method only; whether to use the mean. |
Minimum value | The default is 0. For the min-max method only; specifies the minimum value. |
Maximum value | The default is 1. For the min-max method only; specifies the maximum value. |
Singular value decomposition (SVD) is a dimensionality reduction method that simplifies numerical data by projecting it into a lower-dimensional space using higher singular values. This feature only supports operations on numerical attributes with the role "regular". The output result usually needs to be used as input for other analytical models.
tip
regular: Refers to basic data attributes that are used as regular input features for model training or analysis. These attributes are the core basis for model computation and learning, and do not serve special functions (such as identifying the sample ID or acting as filter criteria used only for data selection).
Usage example:
Example 1: Dimensionality reduction for financial risk control features
Example 2: Retail user profile construction
Parameter description:
Parameter | Description |
|---|---|
Feature column | Features used for training; here, this refers to the numerical features involved in decomposition. You can select multiple options. |
Dimensionality reduction method | Determines the dimensionality reduction method and the degree of reduction.
|
Feature hashing (Hashing Trick) is a fast dimensionality reduction technique that maps high-dimensional features (such as text word frequencies and categorical variables) into a fixed-dimensional vector space using a hash function. It is suitable for feature compression of large-scale sparse data and avoids the dimensionality explosion problem of traditional one-hot encoding.
Usage examples:
Example 1: Text word frequency dimensionality reduction
singleword_counts (a dictionary column storing word frequencies, such as {"apple":3, "banana":1})false{"apple":3, "banana":1, ...} (more than 10,000 words)[0.0, 1.2, 0.0, ..., -0.8] (512-dimensional vector)Example 2: User behavior feature compression
subset["click_ids", "view_ids"]falseclick_ids=[123,456,...], view_ids=[789,...][0.5, 0.0, -1.3, ..., 0.7] (256-dimensional vector)Parameter description:
Parameter | Description |
|---|---|
Selection type | Select field range: |
Inverse selection | If enabled, the unselected columns will be retained. |
Number of features | The feature dimension after dimensionality reduction. The default is 1024. It is recommended to set it as a power of 2 (such as 256 or 512). |
One-hot encoding is a method for converting discrete categorical variables into a form that is easier for machine learning algorithms to understand. It expands a feature with N different values into N binary features (0/1), with each new feature corresponding to one possible value of the original feature.
Usage example:
Example 1: Color feature encoding
Original data:
product_id | color |
|---|---|
1001 | red |
1002 | blue |
1003 | green |
Parameter settings:
Processed result:
product_id | color |
|---|---|
1001 | [1, 0, 0] |
1002 | [0, 1, 0] |
1003 | [0, 0, 1] |
Example 2: Simultaneous encoding of multiple columns
Original data:
user_id | gender | age_group |
|---|---|---|
2001 | male | young |
2002 | female | middle |
2003 | male | old |
Parameter settings:
Processed result:
user_id | gender | age_group |
|---|---|---|
2001 | [1, 0] | [1, 0, 0] |
2002 | [0, 1] | [0, 1, 0] |
2003 | [1, 0] | [0, 0, 1] |
Parameter description:
Parameter | Description |
|---|---|
Column | Features used for training; here, this refers to the text fields that require one-hot encoding. You can select multiple options. |
Array processing is an operator for batch operations on array-type fields (such as [1.2, 0.5, -0.3]), with the core function of converting array types into one-hot encoding types.
Usage example:
Example 1: Convert array to one-hot encoding
Original data:
ID | raw_vector |
|---|---|
1 | [1, 2, 3] |
2 | [2, 3] |
3 | [3] |
Parameter settings:
After processing:
ID | features |
|---|---|
1 | [1, 1, 1] |
2 | [0, 1, 1] |
3 | [0, 0, 1] |
Parameter description:
Parameter | Description |
|---|---|
Column | Select the column containing arrays. |
Number of sampled data rows | The sample size used to analyze all possible values in the array. The default is 200,000. |
Map processing is an operator used with machine learning algorithms, operating on feature fields of type map<string, double>. The core function is to convert map<string, double> type to an array type with one-hot encoding. The system first samples the specified number of rows to analyze all possible keys, then processes the entire dataset uniformly.
Usage example:
Example 1: Convert map data to one-hot encoding
Original data table
order_id | order_detail (map<string, double> type) |
|---|---|
10001 | {"price":299.0, "items":2.0} |
10002 | {"price":599.0, "discount":0.8} |
Parameter settings:
Processed result table:
order_id | features |
|---|---|
10001 | [1, 1, 0] |
10002 | [1, 0, 1] |
Parameter description:
Parameter | Description |
|---|---|
Column | Select the column containing |
Number of sampled data rows | The sample size used to analyze all possible keys in the map. The default is 200,000. |
Feature importance is used to calculate the weight of each feature in the dataset, helping to identify the features that have the greatest impact on the target variable. Multiple calculation methods are supported and are applicable to vector or single-column features. For vector columns, the output format is original_column_name__index (index starts from 0).
Usage example:
Example 1: House price prediction
Original data table (house_data)
house_id | area | rooms | location_score | price_label |
|---|---|---|---|---|
1001 | 85 | 3 | [0.7,0.2] | 1 |
1002 | 60 | 2 | [0.5,0.3] | 0 |
1003 | 120 | 4 | [0.9,0.1] | 1 |
Parameter settings
["area", "rooms", "location_score"]price_labelgini (Gini coefficient)Processed result table
column | weight |
|---|---|
area | 0.78 |
rooms | 0.65 |
location_score__0 | 0.42 |
location_score__1 | 0.15 |
Example 2: Credit card default analysis
Original data table (credit_data)
user_id | income | debt_ratio | payment_history | default_flag |
|---|---|---|---|---|
2001 | 50000 | 0.35 | [1,1,0,1] | 0 |
2002 | 32000 | 0.72 | [0,1,0,0] | 1 |
Parameter settings
["income", "debt_ratio", "payment_history"]default_flaginfo_gain_ratio (information gain ratio)Processed result table
column | weight |
|---|---|
debt_ratio | 0.91 |
payment_history__0 | 0.47 |
payment_history__1 | 0.32 |
income | 0.28 |
Parameter description:
Parameter | Description |
|---|---|
Feature column | Features used for training; here, this refers to the features for which weights need to be calculated. You can select multiple options. |
Label column | The basis for classification training; only a single option can be selected. |
Feature importance calculation method |
|
Feature selection calculates the importance weight of each feature with respect to the target variable, helping users identify key features and remove redundant ones. Supports numerical and vector features, and automatically expands vector columns (format: original_column_name__index). Applicable to preliminary feature selection for classification and regression tasks.
Usage example:
Example 1: Financial risk control feature selection
Original data table (loan_risk)
user_id | income | debt_ratio | behavior_scores | is_default |
|---|---|---|---|---|
1001 | 50000 | 0.3 | [0.8, 0.2, 0.5] | 0 |
1002 | 32000 | 0.6 | [0.6, 0.3, 0.1] | 1 |
Parameter settings
["income", "debt_ratio", "behavior_scores"]is_defaultinfo_gain_ratio (information gain ratio)Processed result
Feature name | Importance score | Keep |
|---|---|---|
debt_ratio | 0.85 | ✓ |
behavior_scores__0 | 0.42 | ✓ |
income | 0.25 | ✗ |
behavior_scores__1 | 0.18 | ✗ |
behavior_scores__2 | 0.10 | ✗ |
Final retained features: debt_ratio, behavior_scores__0
Example 2: E-commerce recommendation feature selection
Original data table (user_behavior)
user_id | click_count | purchase_history | user_group |
|---|---|---|---|
2001 | 20 | [1, 0, 1, 1, 0] | A |
2002 | 5 | [0, 1, 0, 0, 1] | B |
Parameter settings
["click_count", "purchase_history"]user_groupgini (Gini coefficient)Result after processing
Feature name | Importance score | Keep |
|---|---|---|
purchase_history__0 | 0.62 | ✓ |
purchase_history__3 | 0.55 | ✓ |
click_count | 0.38 | ✗ |
purchase_history__1 | 0.22 | ✗ |
Final retained features: purchase_history__0, purchase_history__3
Parameter description:
Parameter | Description |
|---|---|
Feature columns | Features used for training. Here, it refers to the features for which weights need to be calculated. Multiple selections are supported. |
Label column | The basis for classification training. Only one can be selected. |
Feature importance calculation method |
|
Weight-based selection |
|