This topic describes how to prepare and register a source table in ABTest to help you visualize the effect and metric data of the experiment.
Background information
After an application generates various behavior logs, the application sends data back to a MaxCompute log table based on event tracking. The MaxCompute log table is the source table. The table can be registered to ABTest Server, and the computing fields of the table are used to define metrics. The system calculates the daily or hourly metrics based on the partition information of the table. For more information about ABTest, see Architecture of ABTest.
Prepare a source table
Create a source table that must include the following fields. For more information, see Create tables.
Field | Data type | Description | Required |
user_id | STRING | The user identifier, which can be the unique ID (UID) of a user or the ID or International Mobile Equipment Identity (IMEI) of a device. | Yes |
exp_id | STRING | The experiment ID returned by ABTest. The experiment ID is returned by using event tracking. Example: | Yes |
Computing fields | A numeric data type, such as BIGINT, INT, or FLOAT | The custom computing fields, such as show_cnt (number of exposures) and click_cnt (number of clicks). | Yes |
dt | STRING | The date partition in the | Yes |
hh | STRING | The hour partition. Valid values: 00 to 23. The 24-hour clock is used. | No |
mm | STRING | The minute partition. Valid values: 00 to 59. | No |
You can use one of the following methods to generate data based on your business requirements:
Offline output: The source table must contain the user_id, exp_id, and dt fields. If the source table contains only the dt field as the partition field, metrics are calculated only by day.
Real-time output: The source table must contain the user_id, exp_id, dt, and hh fields. The mm field is optional.
If the source table contains the hh field, metrics are calculated by hour and day. For metric calculation by hour, the system collects metric data at intervals of 5 minutes. If the source table contains the dt field excluding the hh field, metrics are calculated by day.
Register a table
Go to the ABTest page.
Log on to the PAI console.
In the left-side navigation pane, click Workspaces. On the Workspaces page, click the name of the workspace that you want to manage.
In the left-side navigation pane, choose .
In the left-side navigation pane of the ABTest page, choose .
On the Table page, click Register Table.
On the Register Table page, configure the parameters. The following table describes the parameters.
Parameter
Description
Name
The name of the table.
Description
The description of the table.
MaxCompute Project
Select a MaxCompute project.
MaxCompute Table
Select a MaxCompute table. The system imports the field information of the table and displays the field information in the Data Fields section in the lower part of the page. If the field information fails to be imported, click Start Import.
NoteThe MaxCompute table must contain the user_id, exp_id, and dt fields.
After you confirm that the fields in the table are correct, click OK.
References
After you register a table, you can create an experiment metric and define its computing logic. For more information, see Create an experiment metric.