PAI-Rec Recommendation Platform - Data format for the content recommendation scenario
PAI-Rec uses three tables to model your content recommendation system: a user table, an item table, and a behavior log table. Each table has required fields and optional fields. Populating more fields improves recommendation quality.
At a glance
| Table | Required fields | Recommended optional fields |
|---|---|---|
| User table | user_id (logged-on users), imei (anonymous users) | register_time, tags |
| Item table | item_id, status, pub_time | title, category, author |
| Behavior log table | item_id, exp_id, event, event_time | request_id, playtime, device_platform |
User table
The user table stores profile data for all users registered in your system. Create a daily partition and sync all user data to it each day.
| Field | Required | Description |
|---|---|---|
user_id | Yes, for logged-on users | Unique user ID. |
imei | Yes, for anonymous users | International Mobile Equipment Identity (IMEI). |
register_time | Recommended | Unix timestamp of account registration, in seconds. Example: 1520017038. Enables time-based user segmentation for recommendations. |
gender | No | User gender. |
age | No | User age. |
country | No | Country. |
province | No | Region, state, or province. |
city | No | City. |
ip | No | IP address from the last login. |
education | No | Education background. |
career | No | Occupation. |
item_cnt | No | Number of content pieces the user has created since registration. |
favorite_cnt | No | Number of favorites. |
follow_cnt | No | Number of users this user follows. |
follower_cnt | No | Number of followers. |
last_login_time | No | Last login time. |
tags | No | User tags. Enables interest-based personalization. |
Item table
The item table stores metadata for all content in your system. Create a daily partition and sync all content data to it each day.
| Field | Required | Description |
|---|---|---|
item_id | Yes | Content ID. |
item_type | Yes, for multi-type content | Content type, such as article or video. |
status | Yes | Whether the item is eligible for recommendation. |
duration | No, required for videos | Video duration. |
pub_time | Yes | Publication time. |
title | Recommended | Content title. Enables text-based feature extraction to improve content matching. |
category | Recommended | Level-1 tag. Improves category-based recommendation accuracy. |
tags | No | Content tags. Separate multiple tags with semicolons (;). |
author | Recommended | Author. Enables author-preference modeling. |
abstract | No | Content abstract. |
content | No | Content body. |
image_url | No | Image URL, used to extract image features. |
video_url | No | Video URL, used to extract video features. |
pv_count | No | Total page views (PVs). |
click_count | No | Total clicks. |
praise_count | No | Total likes. |
comment_count | No | Total comments. |
collect_count | No | Total times added to favorites. |
share_count | No | Total shares. |
download_count | No | Total downloads. |
tip_count | No | Total rewards. |
Behavior log table
The behavior log table captures user interactions with content—either across the entire app or within specific scenarios. Include at least 30–60 days of historical data.
| Field | Required | Description |
|---|---|---|
user_id | Yes, for logged-on users | Unique user ID. |
imei | Yes, for anonymous users | IMEI. |
item_id | Yes | Content ID. |
item_type | Yes, for multi-type content | Content type, such as article or video. |
request_id | No | Unique identifier for each recommendation request. See the warning below. |
request_info | Recommended | Request tracking information, such as experiment ID. |
exp_id | Yes | Experiment ID returned by the PAI-Rec recommendation interface. If the result was not served by PAI-Rec, set this field to default or another value. |
scene | Yes, for multi-scenario apps | Scenario. |
page | Recommended, for multi-page apps | Current page. |
source_page | Recommended, for multi-page apps | Previous page. |
position | No | Position of the content on the page. |
event | Yes | Event type: exposure, stay, click, favor, download, buy, cart, or evaluate. |
event_time | Yes | Timestamp of the event. |
playtime | Recommended | Playback duration or reading duration, in seconds. Improves engagement-based ranking for video and long-form content. |
comment | No | Comment content. |
net_type | No | Network type. |
device_platform | Recommended | Client platform. Enables device-specific feature modeling. |
device_brand | No | Client device brand. |
device_model | No | Client device model. |
device_system | No | Client device operating system. |
app_version | No | App version. |
longitude | No | Longitude. |
latitude | No | Latitude. |
ip | No | Used to extract country and city features. |
Leaving request_id blank reduces training sample accuracy and prevents real-time features from being added. request_id is optional when you first create a recommendation solution, but populating it later requires modifying the training sample code, regenerating training samples, and rerunning model training. Populate this field from the start to avoid rework.