Feature configuration is a core part of setting up a recommendation solution. You define the features you want through the interface, and the system automatically generates the MaxCompute and Flink SQL code that computes them. It produces common statistical features, sequence features, MinMax features, and preference key-value (KV) statistical features, and outputs them as samples for the vector recall, coarse ranking, and fine ranking models.
1. Common periodic behavior types
Common Period: You can configure the statistical periods yourself. Typically, configure a short, a medium, and a long period. Do not configure too many periods, because each additional period multiplies the feature count. For example, if one period generates 200 features, three periods generate 600 features, and six periods generate 1,200 features.
Key Behaviors: The enumerated behavior values that you enter in the behavior table. Keep them to five or fewer. Too many behaviors, like too many periods, generate too many features. If you have too many behavior types, merge the less important ones or the ones with the same meaning when you prepare the upstream tables. List the behaviors in the chronological order in which they occur, such as exposure, click, and then praise. These correspond to the
expr,click, andpraiseenumerated values from the event field. An incorrect order affects the generation of the ratio features described in the following sections and creates manual work downstream.After you configure the statistical periods and the behavior types, click Generate Feature. The system uses these settings together with the basic features (categories, numerical values, tags, and so on) provided by the three upstream tables (user, item, and behavior). It then automatically derives multiple statistical features on both the user side and the item side.
2. Basic derived features
Based on how you configure the three upstream tables, the corresponding basic attribute features already include some automatically derived features. You can also click Add to add more basic derived features. Basic attribute feature derivation is available on the user side, the item side, and the behavior side.
IP Derivation: Derives features only from the IP field that is configured in the corresponding upstream table. Based on your configuration, it resolves the IP address into province, city, and country features. The resolution result has a certain margin of error.
Time Since Calculation: Calculates the number of days since the registration date of a user or an item.
Binning of numerical features: Applies only to numerical fields. The values are split at the split points that you enter, and the result is a categorical feature.
Feature combination: Combines multiple categorical fields, such as category with category, category with tag, or tag with tag. The combined fields must belong to the current table, and must all be on the user side or all on the item side.
Click the behavior table to see two more basic derivations:
Time Slot of Day Processing: Derives the hour of the day in which the behavior log occurred.
Weekday Time Slot Processing: Derives the day of the week in which the behavior log occurred.
If you add basic derived features manually, click Save in the upper-right corner to apply them.
3. Large language model (LLM) embedding conversion
LLM embedding conversion supports the following two types:
Text embedding: You can select only an LLM text input field that is configured in the data table settings. The LLM invocation information must use the
TEXT_EMBEDDINGtype.Multi-modal embedding: Unlike text embedding, multi-modal embedding supports video and image embedding. The field configuration is multi-select, and you must assign each field its corresponding modality type. If the type is
MULTI_IMAGES, the corresponding field type must bearray<string>. When one multi-modal embedding type is configured with multiple input fields, these inputs jointly produce one embedding. To make each field produce its own embedding, configure multiple groups. The LLM invocation information must use theMULTI_MODAL_EMBEDDINGtype.
4. Behavior preference statistics
Multiple statistical features are already derived automatically. Both the user side and the item side have corresponding statistical features, and user IDs and item IDs serve as the aggregation keys by default. The following six types of statistics are available:
Behavior statistics
Conversion rate calculation
Behavior count on top preference attribute features
Behavior proportion on top preference attribute features
Preference numerical features
Top category and numerical combination feature calculation
If you do not need certain features, click Delete on the right to remove them, or click Edit to remove a specific attribute. To add features, click Add in the lower-right corner and continue to add statistical features of multiple types. The following sections describe each of these statistical features.
Behavior statistics
Behavior statistics count how many times each behavior, such as expr, click, and praise, occurs for a user within each statistical period, such as 3, 7, or 15 days. If you specify a Deduplication ID, the count is deduplicated by that ID. If you configure a Scenario, only the behaviors that occur in that scenario are counted. The number of features generated equals the number of statistical periods multiplied by the number of statistical behaviors.
Conversion rate calculation
Conversion rate calculation divides one behavior count by another, such as the click count divided by the expr count, or the praise count divided by the click count. The conversion rates are calculated for a user within each statistical period, such as 3, 7, or 15 days. If the formulas do not meet your requirements, you can modify, add, or delete them. If you configure a Scenario, only the behaviors that occur in that scenario are counted. The number of features generated equals the number of statistical periods multiplied by the number of conversion rate formulas.
Behavior count on top preference attribute features
Behavior count on top preference attribute features counts the specified behaviors on a categorical or multi-value categorical attribute feature. For a user, it counts how many times each behavior, such as expr, click, and praise, occurs for each attribute value within each statistical period, such as 3, 7, or 15 days. The counts are generated as a KV feature. For example, with the day_h category and the click behavior, the generated feature 12:27.0,8:26.0,1:1.0 is returned. It means that the user clicked 27 times at hour 12, 26 times at hour 8, and once at hour 1 within the current period. If you configure a Scenario, only the data in that scenario is counted. If the number of keys is too large, the keys are truncated to 100 by default. The number of features generated equals the number of statistical periods × the number of statistical behaviors × the number of attribute features.
Behavior proportion on top preference attribute features
Behavior proportion on top preference attribute features calculates behavior ratios on a categorical or multi-value categorical attribute feature and generates a KV feature. For a user within each statistical period, such as 3, 7, or 15 days, it calculates ratios such as click/expr (CTR) and praise/click (CVR) for each attribute value. For example, with the cate category as the column and the click/expr formula, the generated feature 12:0.27,8:0.26 is returned. It means that the user's click-through rate (CTR) is 0.27 for category 12 and 0.26 for category 8 within the current period. If you configure a Scenario, only the data in that scenario is counted. If the number of keys is too large, the keys are truncated to 100 by default. The number of features generated equals the number of statistical periods × the number of conversion rate formulas × the number of attribute features.
Preference numerical features
Preference numerical features aggregate the numerical attribute that you select. For a user, the aggregation is performed for each statistical period, such as 3, 7, or 15 days, and each behavior, such as expr, click, and praise. The calculation logic can be sum, maximum, minimum, mean, and so on. If you configure a Scenario, only the data in that scenario is counted. The number of features generated equals the number of statistical periods × the number of behaviors × the number of numerical features.
Top category and numerical combination feature calculation
Top category and numerical combination feature calculation calculates a user's preference for a numerical value under the corresponding categorical feature. For a user, it applies calculation logic such as sum, maximum, minimum, or mean for each statistical period, such as 3, 7, or 15 days, and each behavior, such as expr, click, and praise. If you configure a Scenario, only the data in that scenario is counted. The number of features generated equals the number of statistical periods × the number of behaviors × the number of categorical features in the combination.
5. Sequence features
Sequence features can be set only on the user side. A recommendation system has no sequence features at the beginning, so you first rely on existing historical behavior data to simulate real-time sequence features. This saves the time required to collect sequence features online and accelerates the experiment launch. The following parameters control how the sequence is simulated and constructed:
Simulated Event: Usually an exposure event.
Period to Prevent Feature Leakage: Excludes the behaviors of the last N seconds from the current behavior sequence. Behavior logs take time to propagate, so some data is delayed during inference. In addition, simulated data that is too close to real time causes leakage in training.
Sequence Feature Separator: The separator between sequences when a sequence is constructed.
Sub-feature Separator: The separator between sub-features within one sequence.
Behavior Period: The number of recent days over which behaviors are counted. If multiple sequence groups are configured, the longest period takes effect.
Statistical Behavior: The type of behavior to count.
Scenario: Counts only the behaviors in this scenario. If you leave it blank, the behaviors in all scenarios are counted.
Deduplication ID: Deduplicates the sequence based on this sub-feature, and retains only the last occurrence of the behavior up to the current time.
Sub-feature: The sub-features of the sequence feature. These are usually non-statistical features on the item side, including categorical, multi-value categorical, and numerical features.
Number of stages: The maximum length of the sequence to retain.
6. Real-time features
You can create real-time statistical features with either user IDs or item IDs as the primary key. For real-time features, the unit of the statistical period is seconds.
The Period to Prevent Feature Leakage works the same way as in sequence features. Behaviors within the last N seconds of the target behavior are excluded from the count. Behavior logs take time to travel from the client to the message middleware, and then to be counted and written to the online storage service. If you do not set this period, the online statistics cannot capture the data that you expect.
The following four types of statistics are available:
Behavior statistics
Conversion rate calculation
Behavior count on top preference attribute features
Behavior proportion on top preference attribute features
These four types have the same meanings as their counterparts in behavior preference statistics. Only the period differs.
7. Aggregation features
Aggregation features can be set on both the user side and the item side. You must select the aggregation conditions. Only categorical features can serve as aggregation conditions, and you can configure multiple groups.
The corresponding features are calculated based on the current aggregation conditions. The available statistical types are the same as the statistical types of behavior preference statistics, and they have the same meanings. For example, the following table counts the total number of clicks, praises, and exposures for different combinations of gender and age. For an item such as lipstick, female users click it noticeably more often, so counting item statistics by gender is useful.
Primary key | Category | Calculation logic |
User ID:gender_age | Behavior Statistics | Calculate the number of the [expr,click, praise] behaviors within [3,17] days from the dimension of the (gender] primary key |