在使用PAI-Rec的推薦算法定制的過程中,我們可以應用召回模型產出的數據用來作為詳情頁相關推薦的數據。利用用戶分組熱門召回(UserGroupHotRecall)、全局熱門召回(UserGlobalHotRecall),作為全局推薦數據的補全數據。也可以使用Spark、Flink等系統中產出i2i和熱門數據作為召回數據,只要數據符合PAI-Rec引擎的召回格式即可。
PAI-Rec引擎配置單怎么填寫?
召回和過濾邏輯如下:
ProductDetailPageEtrecRecall:eTrec協同過濾算法計算得到的i2i相關物品作為第一優先級的推薦結果。
GroupHotRecall:分組熱門的結果,這里是用物品的類目(category)統計得到的熱門排行榜。
GlobalHotRecall:全局熱門排行榜,當i2i和類目熱門的結果都不足的時候,使用全局熱門排行榜補全。
UserExposureFilter:對該用戶過濾已經曝光過的物品。
{
"RecallConfs": [
{
"Name": "ProductDetailPageEtrecRecall",
"RecallType": "ItemCollaborativeFilterRecall",
"RecallCount": 50,
"ItemCollaborativeDaoConf": {
"AdapterType": "hologres",
"HologresName": "pairec-holo",
"Item2ItemTable": "i2i_table"
}
},
{
"Name":"GroupHotRecall",
"RecallType": "UserGroupHotRecall",
"RecallCount" :500,
"Triggers": [
{
"TriggerKey": "category"
}
],
"DaoConf":{
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "group_hotness_table"
}
},
{
"Name":"GlobalHotRecall",
"RecallType": "UserGlobalHotRecall",
"RecallCount" :500,
"DaoConf":{
"AdapterType": "hologres",
"HologresName": "holo_info",
"HologresTableName": "global_hotness_table"
}
}
],
"FilterConfs": [
{
"Name": "UserExposureFilter",
"FilterType": "User2ItemExposureFilter",
"MaxItems": 100,
"TimeInterval": 7200,
"WriteLog": true,
"DaoConf": {
"AdapterType": "hologres",
"HologresName": "pairec-holo",
"HologresTableName": "exposure_history"
}
}
],
"SortNames": {
"default": [
"ItemRankScore"
]
},
"FilterNames": {
"default": [
"UniqueFilter",
"UserExposureFilter"
]
},
"AlgoConfs": [],
"HologresConfs": {
"pairec-holo": {
"DSN": "postgres://{AK}:{SK}@{Host}:{Port}/{DB}?sslmode=disable&connect_timeout=1"
}
},
"KafkaConfs": {},
"RedisConfs": {},
"SceneConfs": {
"product_detail_page": {
"default": {
"RecallNames": [
"ProductDetailPageEtrecRecall"
]
}
}
},
"LogConf": {
"RetensionDays": 3,
"DiskSize": 20,
"LogLevel": "INFO"
},
"RankConf": {},
"FeatureConfs": {}
}
引擎接口如何配置
接口名稱
/api/rec/feed
請求參數
參數名稱 | 參數說明 | 類型 | 是否必須 | 用例 |
uid | 用戶id | string | 是 | “1000079” |
item_id | 商品id | string | 是 | "9237438" |
size | 獲取item數量 | integer | 是 | 10 |
scene_id | 場景id | String | 是 | home_feed |
features | 上下文特征 | json map | 否 | {“current_detail_item_id”:20, “sex”:”male”} |
debug | debug 用,打印更多的日志 | bool | 否 | true |
請求樣例
curl -v http://host/api/rec/feed -d '
{"uid":"76295990",
"item_id":"9237438"
"size":1,
"scene_id":"home_feed"}'
返回數據
{
"code":200,
"msg":"success",
"request_id":"e332fe9c-7d99-45a8-a047-bc7ec33d07f6",
"size":1,
"items":[
{
"item_id":"3v5RE7417j7R",
"score":0.0045,
"retrieve_id":"ProductDetailPageEtrecRecall"
}
]
}
文檔內容是否對您有幫助?