PAI-Rec Recommendation Platform - Data format for the content recommendation scenario

Updated at:

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

TableRequired fieldsRecommended optional fields
User tableuser_id (logged-on users), imei (anonymous users)register_time, tags
Item tableitem_id, status, pub_timetitle, category, author
Behavior log tableitem_id, exp_id, event, event_timerequest_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.

FieldRequiredDescription
user_idYes, for logged-on usersUnique user ID.
imeiYes, for anonymous usersInternational Mobile Equipment Identity (IMEI).
register_timeRecommendedUnix timestamp of account registration, in seconds. Example: 1520017038. Enables time-based user segmentation for recommendations.
genderNoUser gender.
ageNoUser age.
countryNoCountry.
provinceNoRegion, state, or province.
cityNoCity.
ipNoIP address from the last login.
educationNoEducation background.
careerNoOccupation.
item_cntNoNumber of content pieces the user has created since registration.
favorite_cntNoNumber of favorites.
follow_cntNoNumber of users this user follows.
follower_cntNoNumber of followers.
last_login_timeNoLast login time.
tagsNoUser 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.

FieldRequiredDescription
item_idYesContent ID.
item_typeYes, for multi-type contentContent type, such as article or video.
statusYesWhether the item is eligible for recommendation.
durationNo, required for videosVideo duration.
pub_timeYesPublication time.
titleRecommendedContent title. Enables text-based feature extraction to improve content matching.
categoryRecommendedLevel-1 tag. Improves category-based recommendation accuracy.
tagsNoContent tags. Separate multiple tags with semicolons (;).
authorRecommendedAuthor. Enables author-preference modeling.
abstractNoContent abstract.
contentNoContent body.
image_urlNoImage URL, used to extract image features.
video_urlNoVideo URL, used to extract video features.
pv_countNoTotal page views (PVs).
click_countNoTotal clicks.
praise_countNoTotal likes.
comment_countNoTotal comments.
collect_countNoTotal times added to favorites.
share_countNoTotal shares.
download_countNoTotal downloads.
tip_countNoTotal 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.

FieldRequiredDescription
user_idYes, for logged-on usersUnique user ID.
imeiYes, for anonymous usersIMEI.
item_idYesContent ID.
item_typeYes, for multi-type contentContent type, such as article or video.
request_idNoUnique identifier for each recommendation request. See the warning below.
request_infoRecommendedRequest tracking information, such as experiment ID.
exp_idYesExperiment 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.
sceneYes, for multi-scenario appsScenario.
pageRecommended, for multi-page appsCurrent page.
source_pageRecommended, for multi-page appsPrevious page.
positionNoPosition of the content on the page.
eventYesEvent type: exposure, stay, click, favor, download, buy, cart, or evaluate.
event_timeYesTimestamp of the event.
playtimeRecommendedPlayback duration or reading duration, in seconds. Improves engagement-based ranking for video and long-form content.
commentNoComment content.
net_typeNoNetwork type.
device_platformRecommendedClient platform. Enables device-specific feature modeling.
device_brandNoClient device brand.
device_modelNoClient device model.
device_systemNoClient device operating system.
app_versionNoApp version.
longitudeNoLongitude.
latitudeNoLatitude.
ipNoUsed to extract country and city features.
Warning

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.