All Products
Search
Document Center

Content industry

Last Updated: Jul 28, 2021

Data description

For a content scene, you must prepare three data tables:

  1. Item table: This table contains all the recent content that can be recommended in the current scene. The number of items is limited by quota. We recommend that you deduplicate items before you upload the table. The item_id and item_type fields are used together to uniquely identify an item.

  2. User table: This table contains all users who have recently logged on to the system. The number of users is limited by quota. We recommend that you deduplicate users before you upload the table. You can use the imei field or a combination of the user_id and imei fields to identify users. For example, in the latter case, you can use user_id to identify users who have logged on and use imei to identify users who have not logged on. Make sure that all users are unique. When you request recommendation results, you must specify the unique identifiers of users. Otherwise, personalized recommendations cannot be achieved.

  3. Behavior table: This table contains the recent behavioral data of the current scene. We recommend that you provide behavioral data generated during the last one to two weeks. If behavioral data cannot be provided due to technical reasons or no historical data is available because the scene is new, you can use the test data provided by AIRec. In this case, the recommendation model may return unsatisfactory results for about two weeks. The effect gradually becomes better and gets stable at last as more data is accumulated. We recommend that you specify as many optional fields in the tables as possible. The more valid optional fields you specify, the better the recommendation effect is. If an optional field is not specified, the system uses its default value.

Table schema

You must specify the fields that are marked as "Required" in the Required column of the following tables. The fields that are marked as "Required" and "Recommended" in the Required column have significant impacts on the recommendation effect. They are described in the "Value description" column.

Item table

Field name

Data type

Required

Field description

Valid value

Value description

Example

item_id

string

Required

The unique ID of an item.

Custom

The item_id and item_type fields uniquely identify an item.

34513

item_type

string

Required

The type of the item.

image, article, video, shortvideo, item, recipe, and audio (If the enumerated values do not meet your business requirements, contact technical support.)

The uploaded data must match the specified item type. Otherwise, mixed sorting does not take effect.

article

status

string

Required

Specifies whether the item can be recommended.

0/1

1: The item can be recommended.

0: The item cannot be recommended.

Note:

1. If you change the value from 0 to 1, the item is listed after a scheduling period of about one hour.

2. If you change the value from 1 to 0, the listing of the item is immediately removed.

1

scene_id

string

Required

The ID of the scene. Content is launched to different scenes. Scenes are designed based on the access types of users on different web pages.

Custom

1. We recommend that you use an acronym or a combination of letters and digits.

2. Do not use colons (:).

3. Do not set this field to -102. This value is an internal reserved value of the system.

4. If only a single scene is available, set this field to 1.

5. You can set this field to multiple scene IDs and separate them with commas (,). The scene IDs match different web pages to which content is launched. For more information, see Use event tracking.

a101,b102

duration

string

Required for the video industry and optional for other industries

The video duration. The value must be greater than or equal to 0 and less than 36000. Unit: seconds.

Custom

The video duration.

1000

pub_time

string

Required

The time at which the item is published. The value is a UNIX timestamp that is accurate to the second. This field is used to determine whether the item is the latest.

Custom

If you have high requirements for timeliness, this field is required. This field is used for the recommendation of new items.

1520327038

expire_time

string

Recommended

The time at which the item expires. The value is a UNIX timestamp that is accurate to the second.

Custom

1. If the current system time of your server is later than the value of this field, the item expires and is no longer recommended.

2. If all items in the table have expired, the service cannot be started.

3. If this field is left empty, the item never expires.

1520327038

last_modify_time

string

Optional

The time at which the item information was last modified. The value is a UNIX timestamp that is accurate to the second.

Custom

If you have made major updates to a published item and have high requirements for timeliness, you can update this field. This field functions similarly to pub_time. Both of them are used to identify new items.

1520327038

title

string

Recommended

The title of the item.

Custom

This field is used for in-depth semantic analysis. If this field is left empty, partial effects of the algorithm may be lost. We recommend that you specify this field.

The Digital Age Is the Greatest Opportunity

weight

string

Recommended

Specifies whether the item is weighted. Note: 1. For a weighted item, set this field to 100. For an unweighted item, set this field to 1. 2. You must set this field to 100 or 1. Other values are invalid. 3. We recommend that you keep the number of weighted items less than or equal to 10% of the total number of items.

Custom

1. If you leave this field empty, the default value 1 is used.

2. A weighted item is more likely to be recommended.

1

category_level

string

Recommended

The category level, such as level 3.

Custom

If this value does not match the value of the category_path field, the discretization feature is affected.

3

category_path

string

Recommended

The category path, with categories combined by underscores (_).

Custom

1. A category path can contain multiple categories. You must combine the categories with underscores (_).

2. Commas (,) and colons (:) are not allowed. Category paths are used in discretization policies.

12_1024_56

tags

string

Recommended

The tags of the item. Separate multiple tags with commas (,).

Custom

1. Tags are used to describe the features of items. You must manage your own tag library.

2. The algorithm model performs feature analysis based on tags and trains the distribution of hot item data based on behavioral data.

3. The number of tags for one piece of content cannot exceed 100. We recommend that the total number of tags in a tag pool does not exceed 50,000.

4. If tags are sensitive business data, we recommend that you convert the tags to digits based on the related mapping rules and upload the desensitized data.

digitalization,artificial intelligence,AI

author

string

Recommended

The author.

Custom

1. Separate multiple authors with commas (,). A single item can have a maximum of 100 authors.

2. Discretization can be implemented based on authors.

Bob

content

string

Optional

The body part of the item.

Custom

You can set this field to the key segment of the content. A maximum of 5,000 characters are allowed. This field is used for semantic analysis.

The High-level Panel on Digital Cooperation submitted its report "The Age of Digital Interdependence" to the UN Secretary-General on Monday 10 June 2019. Jack Ma, co-chairman of the High-level Panel on Digital Cooperation, said, "I believe the digital era is the greatest opportunity for us. The biggest risk is missing this grand opportunity."

channel

string

Recommended

The channel of the content, such as economy. One item has only one channel.

Custom

organization

string

Optional

The organizations. Separate multiple organizations with commas (,).

Custom

pv_cnt

string

Optional

The number of exposures in one month.

Custom

During service start, if behavioral data in the current scene is sparse, you can add behavioral data of other scenes to this field and the following fields whose names end with _cnt. Timeliness is not required. If the maintenance cost of these fields is high after the model becomes stable, you can process them at a low priority.

100000

click_cnt

string

Optional

The number of clicks in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

1000

like_cnt

string

Optional

The number of likes in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

100

unlike_cnt

string

Optional

The number of dislikes in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

100

comment_cnt

string

Optional

The number of comments in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

100

collect_cnt

string

Optional

The number of favorites in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

100

share_cnt

string

Optional

The number of shares in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

100

download_cnt

string

Optional

The number of downloads in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

100

tip_cnt

string

Optional

The number of rewards in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

100

subscribe_cnt

string

Optional

The number of follows in one month.

Custom

Timeliness is not required. You can process this field at a low priority.

100

source_id

string

Optional

The platform by which the item is launched to the scene.

Custom

For example, you can use 1 to indicate Taobao and 2 to indicate Tmall.

1

country

string

Optional

The country code.

Custom

Set this field to an ISO 3166-1 alpha-3 code.

CHN

city

string

Optional

The city name.

Custom

Hangzhou

features

string

Optional

The item features of the STRING type.

Custom

Separate item features with commas (,). The features must be descriptive.

num_features

string

Optional

The item features of a numeric type.

Custom

Separate item features with commas (,). Make sure that the number of commas (,) in this field is the same for all items.

User table

Field name

Data type

Required

Field description

Valid value

Value description

Example

user_id

string

Required for users who have logged on

The unique ID of a user.

Custom

1. This field is required for users who have logged on.

2. This field uniquely identifies a user.

1234567

user_id_type

string

Optional

The registration type of the user.

1234

1: app.

2: mobile phone number. 3: WeChat. 4: other.

2

imei

string

Required for users who have not logged on

For an Android user, set this field to the MD5 hash of the IMEI. For an iOS user, set this field to the MD5 hash of the IDFA.

Custom

1. This field is required for users who have not logged on.

2. If the MAC address or the device number is invalid, internal user persona information cannot be used. Only the recommendation blocking feature is retained.

MD5 hash of IMEI 358800091015835: 74f25e604e1a9dde7471fe2e25ae54d0, MD5 hash of IDFA 41B2FD07-695A-4A27-8D26-C30ECE6F7EAD: 06e1565409c9fc4887036b97442135ee

third_user_name

string

Optional

The name of a third-party user.

Custom

jack

third_user_type

string

Optional

The name of a third-party platform.

Custom

wechat

phone_md5

string

Optional

The MD5 hash of a mobile phone number. The value must be 32 characters in length.

Custom

d41d8cd98f00b204e9800998ecf8427e

gender

string

Optional

The gender of the user.

male, female, unknown

If gender information is sensitive, you can use digits. For example, use 0 to indicate male, 1 to indicate female, and 2 to indicate unknown.

male

age

string

Optional

The age of the user.

Custom

22

age_group

string

Optional

The age group.

Custom

20-25

country

string

Optional

The country code.

Custom

Set this field to an ISO 3166-1 alpha-3 code.

CHN

city

string

Optional

The city name.

Custom

Hangzhou

ip

string

Optional

The last logon IP address.

Custom

202.113.34.16

device_model

string

Optional

The device model.

Custom

iphoneX

tags

string

Optional

User tags. Separate multiple tags with commas (,).

Custom

Use tags to describe the user.

football,fitness,outdoor

source

string

Optional

The source of the user.

Custom

Toutiao

content

string

Optional

The description of the user.

Custom

register_time

string

Optional

The registration time. The value is a UNIX timestamp that is accurate to the second.

Custom

1520007038

last_login_time

string

Optional

The last logon time. The value is a UNIX timestamp that is accurate to the second.

Custom

1520017038

last_modify_time

string

Optional

The time at which the user information was last modified. The value is a UNIX timestamp that is accurate to the second.

Custom

1520327038

features

string

Optional

The user features of the STRING type.

Custom

Separate the user features, such as user persona, with commas (,).

num_features

string

Optional

The user features of a numeric type.

Custom

Separate user features with commas (,). Make sure that the number of commas (,) in this field is the same for all users.

Behavior table

Field name

Data type

Required

Field description

Valid value

Value description

Example

item_id

string

Required

The item ID.

Custom

The value must be consistent with the value of the item_id field in the item table.

34513

item_type

string

Required

The item type.

imagearticlevideoshortvideoitemrecipeaudio

The value must be consistent with the value of the item_type field in the item table.

image

bhv_type

string

Required

The behavior type, such as expose, stay, click, collect, and download.

expose, click

The number of click entries must be less than the number of expose entries. Otherwise, the system may determine that the data is abnormal, and the service cannot be started.

expose

trace_id

string

Required

The request tracking ID. This field is used in A/B testing to determine whether an Alibaba recommendation engine is used.

Alibaba, selfhold

1. If the behavior entry is generated based on an Alibaba recommendation engine, set this field to Alibaba. If the behavioral data is generated based on a self-developed or self-operated recommendation system, set this field to selfhold.

2. This field is used to analyze reports and compare the effects in the console.

Alibaba

trace_info

string

Required

The request tracking information. The information is used for internal link tuning in AIRec.

Custom

1. If trace_id is set to selfhold, set trace_info to 1.

2. If trace_id is set to Alibaba, trace_info is returned in the recommendation result. The value Alibaba indicates that the behavior is performed on an item that is recommended by AIRec. When you upload behavioral data, you need only to specify the original trace_info for the item.

1007.5911.12351.1002000:4ea8bc59-aa9c-11b85be7:46:recommend:5:life:::10:content___5f3b2404c115eac:article:hot_common:0.0869:0.20308921:0.69352831:159895::::::::::

scene_id

string

Required

The scene ID.

Custom

1. The ID of the scene where the behavior entry is generated. The value must be one of the scene IDs for the item that corresponds to the behavior. Only one scene ID is allowed.

2. The value of scene_id for the behavior table must be included in the value of scene_id for the item table.

3. If you do not need to distinguish between scenes, use the default value 1. If the scene ID of the behavior cannot be traced, set this field to -102. For more information, see Use event tracking.

a101

bhv_time

string

Optional

The time at which the behavior occurs. The value is a UNIX timestamp that is accurate to the second.

Custom

Set this field to the time when the user performs the behavior.

1520327038

bhv_value

string

Required

Behavior details, such as the number of clicks, stay duration, and number of purchased items.

Custom

1. For exposures, clicks, and shares, set this field to 1.

2. For stays, specify the stay duration. Unit: seconds.

3. For other behavior, contact technical support.

500

user_id

string

Required for users who have logged on

The user ID.

Custom

1. The value must be consistent with that in the user table.

2. If the user has not logged on, you can leave this field empty.

1234567

platform

string

Optional

The client platform.

Custom

ios/andriod/h5

ios

imei

string

Required for users who have not logged on

For an Android user, set this field to the MD5 hash of the IMEI. For an iOS user, set this field to the MD5 hash of the IDFA.

Custom

1. This field is required for users who have not logged on.

2. If the MAC address or the device number is invalid, internal user persona information cannot be used. Only the recommendation blocking feature is retained.

3. The value must be 32 characters in length.

e2fcdb0f4dce45e35fe2823d797333ec

app_version

string

Optional

The app version number.

Custom

4.1.10

net_type

string

Optional

The network type.

Custom

2G/3G/4G/WIFI

4G

ip

string

Optional

The client IP address.

Custom

234.45.13.14

login

string

Optional

Specifies whether the user has logged on.

01

0: The user has not logged on. 1: The user has logged on.

1

report_src

string

Optional

The report source.

12

1: server. 2: client.

2

device_model

string

Optional

The device model.

Custom

iphoneX

longitude

string

Optional

The longitude.

Custom

128.4

latitude

string

Optional

The latitude.

Custom

78.1

module_id

string

Optional

The module ID.

Custom

114

page_id

string

Optional

The page ID.

Custom

4

position

string

Optional

The position of the item.

Custom

5

message_id

string

Optional

The unique identifier of a behavior entry.

Custom

If you do not specify this field, the system uses the item_id, item_type, user_id, imei, bhv_type, and bhv_time fields to deduplicate behavior entries.

5

Behavior types

bhv_type

Description

expose

The "expose" behavior on an item. The behavior table must contain expose entries. The number of expose entries must be greater than the number of click entries.

click

The "click" behavior on an item. The behavior table must contain click entries.

like

The "like" behavior on an item.

unlike

The "dislike" behavior on an item.

comment

The "comment" behavior on an item.

collect

The "favorite" behavior on an item.

stay

The "stay" behavior on an item.

share

The "share" behavior on an item.

download

The "download" behavior on an item.

tip

The "reward" behavior on an item.

subscribe

The "follow" behavior on an item.

dislike

Negative feedback. For more information, see Improve the accuracy of recommendations by using the negative feedback feature.

CREATE TABLE statements

If you use MaxCompute to report start data, you can refer to the following CREATE TABLE statements:

--- Create a behavior table in the content industry.
DROP TABLE IF EXISTS behavior_table;
CREATE TABLE IF NOT EXISTS `behavior_table`
(
    trace_id STRING COMMENT "Request tracking ID"
    ,trace_info STRING COMMENT "Request tracking information"
    ,platform STRING COMMENT "Client platform"
    ,device_model STRING COMMENT "Device model"
    ,imei STRING COMMENT "Device ID"
    ,app_version STRING COMMENT "App version number"
    ,net_type STRING COMMENT "Network type"
    ,longitude STRING COMMENT "Longitude"
    ,latitude STRING COMMENT "Latitude"
    ,ip STRING COMMENT "Client IP address"
    ,login STRING COMMENT "Whether the user has logged on"
    ,report_src STRING COMMENT "Report source"
    ,scene_id STRING COMMENT "Scene ID"
    ,user_id STRING COMMENT "User ID"
    ,item_id STRING COMMENT "Item ID"
    ,item_type STRING COMMENT "Item type"
    ,module_id STRING COMMENT "Module ID"
    ,page_id STRING COMMENT "Page ID"
    ,position STRING COMMENT "Position of the item"
    ,bhv_type STRING COMMENT "Behavior type"
    ,bhv_value STRING COMMENT "Behavior details"
    ,bhv_time STRING COMMENT "Time at which the behavior occurs"
)
PARTITIONED BY 
(
    ds STRING
)
LIFECYCLE 30
;


--- Create a user table in the content industry.
DROP TABLE IF EXISTS user_table;
CREATE TABLE IF NOT EXISTS `user_table`
(
    user_id STRING COMMENT "Unique user ID"
    ,user_id_type STRING COMMENT "Registration type of the user"
    ,third_user_name STRING COMMENT "Third-party user name"
    ,third_user_type STRING COMMENT "Third-party platform name"
    ,phone_md5 STRING COMMENT "MD5 hash of the mobile phone number of the user."
    ,imei STRING COMMENT "Device ID of the user"
    ,content STRING COMMENT "User content"
    ,gender STRING COMMENT "Gender"
    ,age STRING COMMENT "Age"
    ,age_group STRING COMMENT "Age group"
    ,country STRING COMMENT "Country"
    ,city STRING COMMENT "City"
    ,ip STRING COMMENT "Last logon IP address"
    ,device_model STRING COMMENT "Device model"
    ,register_time STRING COMMENT "Registration time"
    ,last_login_time STRING COMMENT "Last logon time"
    ,last_modify_time STRING COMMENT "Last modification time of user information"
    ,tags STRING COMMENT "User tags"
    ,source STRING COMMENT "Source of the user"
    ,features STRING COMMENT "Additional user features of the STRING type"
    ,num_features STRING COMMENT "Additional user features of a numeric type"
)
PARTITIONED BY 
(
    ds STRING
)
LIFECYCLE 30
;


--- Create an item table in the content industry.
DROP TABLE IF EXISTS item_table;
CREATE TABLE IF NOT EXISTS `item_table`
(
    item_id STRING COMMENT "Unique ID of the item"
    ,item_type STRING COMMENT "Item type"
    ,title STRING COMMENT "Item title"
    ,content STRING COMMENT "Body part of the item"
    ,user_id STRING COMMENT "ID of the user who published the item"
    ,pub_time STRING COMMENT "Publish time"
    ,status STRING COMMENT "Whether the item can be recommended"
    ,expire_time STRING COMMENT "Time at which the item expires, accurate to the second"
    ,last_modify_time STRING COMMENT "Last modification time of item information"
    ,scene_id STRING COMMENT "Scene ID"
    ,duration STRING COMMENT "Duration, in seconds"
    ,category_level STRING COMMENT "Category level"
    ,category_path STRING COMMENT "Category path"
    ,tags STRING COMMENT "Tags"
    ,channel STRING COMMENT "Channels"
    ,organization STRING COMMENT "Organizations"
    ,author STRING COMMENT "Authors"
    ,pv_cnt STRING COMMENT "Exposures"
    ,click_cnt STRING COMMENT "Clicks"
    ,like_cnt STRING COMMENT "Likes"
    ,unlike_cnt STRING COMMENT "Dislikes"
    ,comment_cnt STRING COMMENT "Comments"
    ,collect_cnt STRING COMMENT "Favorites"
    ,share_cnt STRING COMMENT "Shares"
    ,download_cnt STRING COMMENT "Downloads"
    ,tip_cnt STRING COMMENT "Rewards"
    ,subscribe_cnt STRING COMMENT "Follows"
    ,source_id STRING COMMENT "Item source"
    ,country STRING COMMENT "Country"
    ,city STRING COMMENT "City"
    ,features STRING COMMENT "Additional features"
    ,num_features STRING COMMENT "Additional features of a numeric type"
    ,weight STRING COMMENT "Weight of the item, default value: 1"
)
PARTITIONED BY
(
    ds STRING
)
LIFECYCLE 30
;