本文档为您展示一个示例,在本例中,我们将准备一份向量数据(假设数据表的表名为aime_example_vector
),一份X2I召回数据(假设数据表的表名为aime_example_x2i
),一份物品详情数据(假设数据表的表名为aime_example_detail
),及一份行为表(假设行为表的表名为aime_example_exposure
,然后在智能召回引擎控制台上注册数据,最后用这份数据拉起一个向量召回服务。
数据准备
准备物品X2I召回表/向量表
数据准备流程同X2I召回流程及向量召回流程的数据准备一致,详情见快速拉起X2I召回服务数据准备及快速拉起向量召回服务数据准备
准备物品详情表(可选)
在MaxCompute客户端中准备数据
-- 创建数据表
CREATE TABLE IF NOT EXISTS aime_example_detail (
nid STRING COMMENT "物品ID",
title STRING COMMENT "物品名称",
price DOUBLE COMMENT "物品价格"
) PARTITIONED BY (
ds STRING COMMENT "分区字段"
);
-- 写入物品数据,实际业务场景下,具体应该写入您实际的物品详情数据
INSERT OVERWRITE TABLE aime_example_detail PARTITION (ds = '20210822')
SELECT '10001' AS nid, '甜美泡泡袖蝴蝶结宝藏连衣裙' AS title, 269.00 AS price UNION
SELECT '10002' AS nid, '亚麻法式小黑裙连衣裙' AS title, 259.00 AS price UNION
SELECT '10003' AS nid, '法式西装裙收腰衬衫裙子' AS title, 599.00 AS price;
-- 写入标识分区
INSERT OVERWRITE TABLE aime_example_detail PARTITION (ds = '20210822.done')
SELECT NULL, NULL, NULL UNION;
在智能召回引擎控制台上注册数据
进入实例详情-数据管理页面,按照如下方式填写:
点击“下一步”,开始配置索引
点击“下一步”,开始配置全量调度方式
点击“配置完成并上线”,完成注册并发布
准备行为表(可选)
在MaxCompute客户端中准备数据
DROP TABLE IF EXISTS aime_example_expose;
-- 创建数据表
CREATE TABLE IF NOT EXISTS aime_example_expose (
user_id STRING COMMENT "用户ID",
item_id STRING COMMENT "物品ID",
time BIGINT COMMENT "行为时间"
) PARTITIONED BY (
ds STRING COMMENT "分区字段"
);
-- 写入向量数据,实际业务场景下,具体的写入数据由您的算法逻辑产出
INSERT OVERWRITE TABLE aime_example_expose PARTITION (ds = '20210822')
SELECT 'u0001' AS user_id, '10001' AS item_id, 1640275200 AS time UNION -- 20211224
SELECT 'u0001' AS user_id, '10002' AS item_id, 1640275200 AS time UNION -- 20211224
SELECT 'u0002' AS user_id, '10003' AS item_id, 1640275200 AS time UNION -- 20211224
SELECT 'u0002' AS user_id, '10004' AS item_id, 1640275200 AS time UNION -- 20211224
SELECT 'u0003' AS user_id, '10001' AS item_id, 1640275200 AS time UNION -- 20211224
SELECT 'u0003' AS user_id, '10002' AS item_id, 1640188800 AS time UNION -- 20211223
SELECT 'u0003' AS user_id, '10003' AS item_id, 1640102400 AS time UNION -- 20211222
SELECT 'u0003' AS user_id, '10004' AS item_id, 1640016000 AS time UNION -- 20211221
SELECT 'u0003' AS user_id, '10005' AS item_id, 1639929600 AS time UNION -- 20211220
SELECT 'u0003' AS user_id, '10006' AS item_id, 1639843200 AS time UNION -- 20211219
SELECT 'u0003' AS user_id, '10007' AS item_id, 1639756800 AS time UNION -- 20211218
SELECT 'u0003' AS user_id, '10008' AS item_id, 1639670400 AS time UNION -- 20211217
SELECT 'u0003' AS user_id, '10009' AS item_id, 1639584000 AS time UNION -- 20211216
SELECT 'u0003' AS user_id, '10010' AS item_id, 1639497600 AS time; -- 20211215
-- 写入标识分区
INSERT OVERWRITE TABLE aime_example_expose PARTITION (ds = '20210822.done')
SELECT NULL, NULL, NULL;
在智能召回引擎控制台上注册数据
进入实例详情-数据管理页面,按照如下方式填写:
点击“下一步”,开始配置索引
点击“下一步”,开始配置全量调度方式
点击“配置完成并上线”,完成注册并发布
服务注册
在实例详情-服务管理中,点击“创建召回服务”按钮,开始创建召回服务。
选择注册“多路归并召回服务”服务
点击“下一步”,填写基础配置信息:
点击“下一步”,先配置第一路召回链路信息
接下来配置第二路召回链路信息
用户可以根据需求增减子召回链路个数,多路召回需求最少有2路召回
配置多路召回的全局配置
配置完成并上线
进入服务管理,可以看到我们刚才创建的召回服务,等待其发布完成,就可以使用了。
文档内容是否对您有帮助?