Todos los productos
Search
Centro de documentos

Platform For AI:Registro de datos y configuración de campos

Última actualización: Sep 17, 2026

Data registration

Para registrar los datos, active MaxCompute, vincule un proyecto y registre una tabla de MaxCompute.. This registered table serves as an intermediate table for performance statistics, called the experiment report source table. It uses a composite primary key of user_id, exp_id, and dimension fields to aggregate statistics. Each row represents metrics such as exposures and clicks for a specific user in a specific experiment. You can add dimensions such as country to build a more granular intermediate statistics table keyed on user_id, country, and exp_id. All basic and derived metrics depend on this intermediate table. The overall experiment architecture is as follows:

image

PAI-Rec engine is a recommendation service that integrates an SDK from the configuration center to retrieve experiment information. The response includes the experiment ID (exp_id) and a request ID (reqid).

When a user interacts with your application, front-end event tracking collects behavior logs and sends them to MaxCompute. An SQL task processes these logs to generate the experiment report source table. After you configure metrics in the configuration center, the system dynamically assembles SQL queries to compute statistics from this source table. The results are stored in Hologres, and you can view them on the experiment report page.

I. Offline experiment reports

Offline experiment report source table code

CREATE TABLE IF NOT EXISTS experiment_report (
	user_id STRING COMMENT 'User ID',
        exp_id STRING COMMENT 'Experiment ID',
	exposure_count BIGINT COMMENT 'Exposure count',
	click_count BIGINT COMMENT 'Click count',
	like_comment_collect_count BIGINT COMMENT 'Like, comment, and collect count'
)
PARTITIONED  by (dt STRING COMMENT 'Date')
STORED AS ALIORC;
INSERT OVERWRITE TABLE experiment_report PARTITION (dt = '${bdp.system.bizdate}')
SELECT  user_id
        ,exp_id
        ,SUM(IF(event == 'expose',1,0))
        ,SUM(IF(event == 'click',1,0))
        ,SUM(IF(event IN ('like','comment','collect'),1,0))
FROM    rec_sln_demo_behavior_table_v1
WHERE   ds = '${bdp.system.bizdate}'
GROUP BY user_id
         ,exp_id

Offline experiment report source table schema

Parámetro

Descripción

Obligatorio

Notas

user_id

Identificador de usuario

Sí

Un identificador único de usuario, como un UID, device_id o IMEI.

exp_id

Identificador del experimento

Sí

El identificador del experimento que devuelve el servicio de pruebas A/B y que se registra mediante el seguimiento de eventos. Si utiliza su propio servicio de recomendación, establezca un identificador personalizado. Por ejemplo: ER1_L1#EG1#E1_L2#EG2#E2

Campo de dimensión

Campo que se usa para generar reportes estadísticos más detallados.

No

Utilice este campo para agrupar y mostrar las métricas correspondientes.

Por ejemplo, agregue un campo province para analizar el rendimiento del producto por provincia.

Especifique hasta dos campos de dimensión, como province y city. Un tercer campo genera demasiadas combinaciones y ralentiza considerablemente el procesamiento.

Un campo de dimensión común es recall_idpairec_debug_log en Log Configuration.

Campo de cálculo

Puede incluir varios campos de cálculo.

Por ejemplo: exposure_count

Otro ejemplo: click_count

Sí

Un campo numérico proporcionado por usted, como el conteo de exposiciones, el conteo de clics o la duración de visualización.

dt

Partición de fecha

Sí

Formato: yyyyMMdd

hh

Partición de hora

No

Formato de 24 horas: de 00 a 23.

mm

Partición de minuto

No

De 00 a 59.

You can generate the source table daily for offline reports or hourly for near-real-time reports, depending on your business needs. For example, use DataWorks to schedule a job that runs every hour to process logs from the previous hour. For offline generation, user_id, exp_id, and dt are required. For hourly reports, user_id, exp_id, dt, and hh are required; the mm partition is optional.

A real-time data source supports both offline and real-time metrics. An offline data source supports only offline metrics.

Dimension fields are optional but enable dimensional analysis of your metrics. Common dimension fields include gender and os (operating system, such as iOS or Android), which let you view report data segmented by gender or operating system.

Código de la tabla de origen del reporte de significancia sin conexión

CREATE TABLE IF NOT EXISTS experiment_report_v3 (
    user_id STRING COMMENT 'User ID',
    exp_id STRING COMMENT 'Experiment ID',
    item_id STRING COMMENT 'Item ID',
    request_id STRING COMMENT 'Request ID',
    click_uv BIGINT COMMENT 'Click UV',
    expr_pv BIGINT COMMENT 'Exposure PV'
)
PARTITIONED  by (dt STRING COMMENT 'Date')
STORED AS ALIORC;
INSERT OVERWRITE TABLE experiment_report_v3 PARTITION (dt = '${bdp.system.bizdate}')
SELECT
    user_id,
    exp_id,
    item_id,
    request_id,
    MAX(IF(event = 'click', 1, 0)) AS click_uv,
    SUM(IF(event = 'expr', 1, 0)) AS expr_pv
FROM rec_sln_demo_behavior_table_v1
WHERE   ds = '${bdp.system.bizdate}'
GROUP BY
    user_id,
    exp_id,
    item_id,
    request_id

Offline significance report source table schema

Parámetro

Descripción

Obligatorio

Notas

user_id

Identificador de usuario

Sí

Un identificador único de usuario, como un UID, device_id o IMEI.

exp_id

Identificador del experimento

Sí

El identificador del experimento que devuelve el servicio de pruebas A/B y que se registra mediante el seguimiento de eventos. Si utiliza su propio servicio de recomendación, establezca un identificador personalizado. Por ejemplo: ER1_L1#EG1#E1_L2#EG2#E2

item_id

Identificador del elemento

Sí

request_id

Identificador de la solicitud

Sí

Campo de dimensión

Campo que se usa para generar reportes estadísticos más detallados.

No

Utilice este campo para agrupar y mostrar las métricas correspondientes.

Por ejemplo, agregue un campo province para analizar el rendimiento del producto por provincia.

Especifique hasta dos campos de dimensión, como province y city. Un tercer campo genera demasiadas combinaciones y ralentiza considerablemente el procesamiento.

Un campo de dimensión común es recall_idpairec_debug_log en Log Configuration.

Campo de cálculo

Puede incluir varios campos de cálculo.

Por ejemplo: expr_pv (conteo de exposiciones)

Otro ejemplo: click_uv (conteo de clics)

Sí

Un campo numérico proporcionado por usted, como el conteo de exposiciones o el conteo de clics.

dt

Partición de fecha

Sí

Formato: yyyyMMdd

II. Real-time experiment reports

Real-time experiment report source table code

CREATE TABLE IF NOT EXISTS experiment_report_real (
	user_id STRING COMMENT 'User ID',
        exp_id STRING COMMENT 'Experiment ID',
	exposure_count BIGINT COMMENT 'Exposure count',
	click_count BIGINT COMMENT 'Click count',
	like_comment_collect_count BIGINT COMMENT 'Like, comment, and collect count'
)
PARTITIONED  by (
    dt string
    ,hh string
)
STORED AS ALIORC;
INSERT OVERWRITE TABLE experiment_report_real PARTITION (dt = '${bdp.system.bizdate}',hh = '${hour}')
SELECT  user_id
        ,exp_id
        ,SUM(IF(event == 'expose',1,0))
        ,SUM(IF(event == 'click',1,0))
        ,SUM(IF(event IN ('like','comment','collect'),1,0))
FROM    rec_sln_demo_behavior_table_v1
WHERE   ds = '${bdp.system.bizdate}'
AND hh = hour(now()) -1
GROUP BY user_id
         ,exp_id;

Real-time experiment report source table schema

Parameter

Description

Required

Notes

user_id

User ID

Yes

A unique user identifier, such as a UID, device_id, or IMEI.

exp_id

Experiment ID

Yes

The experiment ID returned by the A/B testing service and logged via event tracking. If you use your own recommendation service, you can set a custom identifier. Example: ER1_L1#EG1#E1_L2#EG2#E2

Dimension field

Example: os (operating system).

No

Used to filter report data by this dimension.

Compute field

You can have multiple compute fields.

Example: exposure_count, click_count.

Yes

A numeric field that you provide, such as exposure count, click count, or view duration.

dt

Date partition

Yes

Format: yyyyMMdd

hh

Hour partition

Yes

24-hour format: 00 to 23.

mm

Minute partition

No

00 to 59.

The fields in the result table are mostly fixed; only dimension fields are variable. The definition of a dimension field in the result table must match its definition in the source table.

Offline metrics and real-time metrics cannot use the same result table. A result table for offline metrics requires only the dt date partition, whereas a real-time table must include at least the hh hour partition.

After you create the experiment report source table, go to Metric Management > Data Registration in the console to add the new MaxCompute data table.

We recommend using the default Hologres table to store metric calculation results. This option does not consume your own resources because the system automatically creates and manages the table. Alternatively, you can use your own Hologres instance and table.

III. Register a MaxCompute table

Click Create Data Table, select your bound MaxCompute project, choose the MaxCompute data table, provide a custom name, and then click Start Import to import the table data.

Nota If the schema of a registered data table changes, you must re-import it promptly. Otherwise, the system may not recognize the field changes.

Field configuration

After registration, the data table appears in the list. Click View Fields to review and edit the fields. The user_id, exp_id, and dt fields are required. Together, these fields track behavior totals such as exposures, clicks, and likes for a specific user (user_id) in a specific experiment (exp_id) on a given day (dt). Custom metrics are defined and calculated based on this table.

Dimension fields

Puede agregar uno o dos campos de dimensión a la tabla. Por ejemplo, si establece city como dimensión, el reporte del experimento muestra una comparación de los resultados por cada ciudad. Si configura tanto city como gender como campos de dimensión, el reporte presenta los resultados agrupados según la combinación de ambos campos.