推荐系统实战第02课召回算法和业界最佳实践Part1
推荐系统实战第02课. Match Algorithms and Practices (Part 1)
召回Match(CF,找到候选者);排序;重排序(多样性/新颖性)
推荐系统的 Match 模块介绍
业界通⽤推荐系统架构
Deep Neural Networks for YouTube Recommendations, RecSys ’16
**Match & Rank **
•定义:Match基于当前user(profile、history) 和context,快速在全库⾥找到TopN最相关的 item,给Rank来做⼩范围综合多⽬标最⼤化。
•通常做法:通常情况下,⽤各种算法做召回,⽐如user/item/model-based CF,Contentbased,Demographic-based、DNN-Embedding-based等等,做粗排之后交由后⾯的Rank层 做更精细的排序,最终展现TopK item
一般来说,需要多种算法就行融合,增加召回率。
Match 算法典型应⽤
猜你喜欢
•多样推荐
相似推荐
•看了还看
搭配推荐
•买了还买
Collaborative Filtering 算法介绍
Collaborative Filtering 定义
•Collaborative Filtering (CF) is the most well-known technique for recommendation.
“CF makes predictions (filtering) about a user’s interest by collecting preferences information from many users (collaborating)” —Wikipedia
从相似的用户(物品),来预测、过滤用户的兴趣。
•数学形式化: 矩阵补全问题
基于共现关系的 Collaborative Filtering 算法
**User-based CF **
•多⽤于挖掘那些有共同兴趣的⼩团体,通常新颖性较好,但是准确性稍差
Item-based CF
•侧重于挖掘item之间的关系,然后根据⽤户的历史⾏为来为⽤户⽣成推荐列表
•相⽐user-based⽅法,item-based 的应⽤更为⼴泛
综合上述问题,在冷启动的问题中,一般来说,Item-based CF会更好
1、相似度:余弦距离
S
i
m
i
l
a
r
i
t
y
(
A
⃗
,
B
⃗
)
=
cos
(
A
⃗
,
B
⃗
)
=
A
⃗
∙
B
⃗
∥
A
⃗
∥
∗
∥
B
⃗
∥
Similarity(\vec{A}, \vec{B})=\cos (\vec{A}, \vec{B})=\frac{\vec{A} \bullet \vec{B}}{\|\vec{A}\|^{*}\|\vec{B}\|}
Similarity(A,B)=cos(A,B)=∥A∥∗∥B∥A∙B
2、用户商品倒排表
用来加速计算User-CF分子,构造用户-商品倒排表即可,只对有效的pair进行计算,从而简化计算。
p u j = ∑ i ∈ N ( u ) ∩ S ( j , K ) w j i r u i p_{u j}=\sum_{i \in N(u) \cap S(j, K)} w_{j i} r_{u i} puj=i∈N(u)∩S(j,K)∑wjirui
UserCF、ItemCF 优缺点对比
基于ItemCF的推荐算法调⽤⽰意图
最新 CF算法 实践
Item CF 算法 最新实践
•改进版 I2I
•motivation:热门⽤户、哈利波特效应、⽤户⾏为缺乏考虑
•solution:热门⽤户降权、热门Item降权
•实时I2I
•motivation:新品推荐问题
•Solution:实时增量i2i
•Hybrid I2I
•motivation:⽆监督学习,⽆法刻画场景差异
•solution:有监督Hybrid多种i2i算法
改进版I2I
降低热门⽤户影响
w
i
j
=
∑
u
∈
N
(
i
)
⋂
N
(
j
)
1
log
1
+
∣
N
(
u
)
∣
∣
N
(
i
)
∣
∣
N
(
j
)
∣
w_{i j}=\frac{\sum_{u \in N(i) \bigcap N(j)} \frac{1}{\log 1+|N(u)|}}{\sqrt{|N(i)||N(j)|}}
wij=∣N(i)∣∣N(j)∣∑u∈N(i)⋂N(j)log1+∣N(u)∣1
分子是两个向量的内积,贡献的数量。
缓解哈利波特效应
所有人都会买哈利波特,其他产品会经常推荐热门的产品。调低后,就不在重视他本身的热门度。
w
i
j
=
∣
N
(
i
)
∩
N
(
j
)
∣
∣
N
(
i
)
∣
∣
−
α
∣
N
(
j
)
∣
α
w_{i j}=\frac{|N(i) \cap N(j)|}{|N(i)|^{ |-\alpha}|N(j)|^{\alpha}}
wij=∣N(i)∣∣−α∣N(j)∣α∣N(i)∩N(j)∣
综合考虑 :1、⽤户⾏为差 2、热门⽤户降权
Sim
(
I
i
,
I
j
)
=
∑
u
∈
U
i
∩
U
j
W
u
2
/
(
1
+
δ
(
a
b
s
(
t
u
i
−
t
u
j
)
)
)
∑
u
∈
U
(
I
i
)
W
u
2
∑
u
∈
U
(
I
j
)
W
u
2
\operatorname{Sim}\left(\mathrm{I}_{\mathrm{i}}, \mathrm{I_j}\right)=\frac{\sum_{\mathrm{u} \in \mathrm{U}_{\mathrm{i}} \cap \mathrm{U}_{j}} \mathrm{W}_{\mathrm{u}}^{2} /\left(1+\delta\left(a b s\left(t_{u i}-t_{u j}\right)\right)\right)}{\sqrt{\sum_{\mathrm{u} \in \mathrm{U}\left(\mathrm{I}_{\mathrm{i}}\right)} \mathrm{W}_{\mathrm{u}}^{2}} \sqrt{\sum_{\mathrm{u} \in \mathrm{U}\left(\mathrm{I}_{\mathrm{j}}\right)} \mathrm{W}_{\mathrm{u}}^{2}}}
Sim(Ii,Ij)=∑u∈U(Ii)Wu2∑u∈U(Ij)Wu2∑u∈Ui∩UjWu2/(1+δ(abs(tui−tuj)))
W u = 1 log 2 ( 3 + q u ) \mathrm{W}_{\mathrm{u}}=\frac{1}{\log _{2}\left(3+\mathrm{q}_{\mathrm{u}}\right)} Wu=log2(3+qu)1
实时I2I(腾讯2015)
sim
(
i
p
,
i
q
)
=
pairCount
(
i
p
,
i
q
)
itemCount
(
i
p
)
itemCount
(
i
q
)
\operatorname{sim}\left(i_{p}, i_{q}\right)=\frac{\text { pairCount }\left(i_{p}, i_{q}\right)}{\sqrt{\text { itemCount }\left(i_{p}\right)} \sqrt{\text { itemCount }\left(i_{q}\right)}}
sim(ip,iq)= itemCount (ip) itemCount (iq) pairCount (ip,iq)
where
(
i
p
)
=
∑
r
u
,
p
\left(i_{p}\right)=\sum r_{u, p}
(ip)=∑ru,p
( i p , i q ) = ∑ u ∈ U c o − r a t i n g ( i p , i q ) \left(i_{p}, i_{q}\right)=\sum_{u \in U} \mathrm{co-rating}\left(i_{p}, i_{q}\right) (ip,iq)=u∈U∑co−rating(ip,iq)
sim ( i p , i q ) ′ = pairCount ( i p , i q ) ′ item Count ( i p ) ′ item Count ( i q ) ′ \operatorname{sim}\left(i_{p}, i_{q}\right)^{\prime}=\frac{\operatorname{pairCount}\left(i_{p}, i_{q}\right)^{\prime}}{\sqrt{\text { item Count }\left(i_{p}\right)^{\prime}} \sqrt{\text { item Count }\left(i_{q}\right)^{\prime}}} sim(ip,iq)′= item Count (ip)′ item Count (iq)′pairCount(ip,iq)′
= pairCount ( i p , i q ) + Δ co-rating ( i p , i q ) itemCount ( i p ) + Δ r u p item Count ( i q ) + Δ r u q =\frac{\text { pairCount }\left(i_{p}, i_{q}\right)+\Delta \operatorname{co-rating}\left(i_{p}, i_{q}\right)}{\sqrt{\text { itemCount }\left(i_{p}\right)+\Delta r_{u_{p}}} \sqrt{\text { item Count }\left(i_{q}\right)+\Delta r_{u_{q}}}} = itemCount (ip)+Δrup item Count (iq)+Δruq pairCount (ip,iq)+Δco-rating(ip,iq)
TencentRec: Real-time Stream Recommendation in Practic
http://net.pku.edu.cn/~cuibin/Papers/2015SIGMOD-tencentRec.pdf
Hybrid i2i——Learning to Rank
Learning to Rank for Information Retrieval,Tie-Yan Liu
https://www.cda.cn/uploadfile/image/20151220/20151220115436_46293.pdf
Hybrid i2i 算法架构
•利⽤LTR的思想重构i2i(以短视频推荐为例)
•Feature
•Trigger-item Relavance: i2i_score/favor2favor sim/text sim…
•Item Feature: video_ctr、video_pv、video_comment、
•Trigger Feature: trigger_ctr、topic_ctr
•Model
•Loss:Pairwise Loss,同时优化CTR、LikeR、FavorR •Lambdamart/Neural Nets
思考题
A.买了还推怎么解决?
B.推荐过于同质化怎么解决?
C.搭配推荐该如何做
Model Based CF 演变历程
Model Based CF 问题定义
Deep Learning for Matching in Search and Recommendation,
Jun Xu Chinese Academy of Sciences
Xiangnan He National University of Singapore
Hang Li Bytedance AI La
Model Based CF算法(SVD)
SVD is Suboptimal for CF
•⼏个缺点
•Missing data和观测到的数据权重相同(>99% 稀疏性)
•没有正则项,容易过拟
Model Based CF算法(Adjust SVD)
The “SVD” model in the context of recommendation:
•Matrix Factorization (MF) 推荐算法
•⽤latent vector来表⽰user和item(ID embedding)
•组合关系⽤ 内积 inner product (衡量user对于某⼀类商品的偏好)
Matrix Factorization Techniques for Recommender Systems, Koren, 2009
Factored Item Similarity Model
•MF ⽤UserID来表⽰⽤户
•可以叫做 user-based CF (i.e., find similar users for recom)
•另外⼀种做法是⽤⽤户评价过的item来表⽰⽤户
•可以叫做 item-based CF (i.e., find similar items for recom)
FISM: Factored Item Similarity Models for Top-N Recommender Systems
SVD++: Fusing User-based and Item-based CF
•MF (user-based CF) ⽤UserID来表⽰⽤户
•直接映射ID到隐空间
•FISM (item-based CF) ⽤⽤户评价的item来表⽰⽤户
•映射items到隐空间
•SVD++ 混合了两种想法
•Netflix 百万⼤奖⽐赛 单模型最佳
FactorizationMeetstheNeighborhood: aMultifaceted CollaborativeFilteringModel
如何融⼊更多的信息(Side Info)
•CF 只⽤交互矩阵来build模型
•如何利⽤ user/item 属性 和 上下⽂?
•Side info 实例
Generic Feature-based Recommendation
FM: Factorization Machines
•FM 受到前⾯所有的分解模型的启发
•每个特征都表⽰成embedding vector,并且构造⼆阶关系
•FM 允许更多的特征⼯程,并且可以表⽰之前所有模型为特殊的FM(⼤家思考⼀ 下)
– E.g.,MF,SVD++,timeSVD(Koren,KDD’09),PITF(Rendle,WSDM’10)etc.
Rating Prediction is Suboptimal
之前的⼯作都在优化L2 loss
– 很多证据表明
⼀个低MSE模型不⼀定代表排序效果好。。
– Possible Reasons:
-
均⽅误差(e.g., RMSE) and 排序指标之间的分歧
-
观察有偏 – ⽤户总是去对喜欢的电影打分
Towards Top-N Recommendation
•现在的⼯作开始逐步朝着优化pairwise ranking loss •Known as the Bayesian Personalized Ranking loss (Rendle, UAI’09). 优化相对序关系,⽽不是优化绝对值
下节预告
Deep Collaborative Filtering Model
•Methods of representation learning
•Methods of matching function learning
BAT搜索推荐核⼼系统架构(2018)
⼈⼯智能在淘宝搜索中的应⽤ https://www.sohu.com/a/212035397_612370
实践:Movielens上的MF实战 (TensorFlow)
其他参考资料
•ItemBased Collaborative Filtering Recommendation Algorithms
•Amazon.com recommendations: Item-to-Item Collaborative Filtering
•推荐系统实战.项亮 http://vdisk.weibo.com/s/aSXlSkLAQjzMT
•天猫推荐业务与算法架构.张奇.2013. http://topic.it168.com/factory/adc2013/ doc/zhangqi.pdf
•淘宝搜索技术演变 https://mp.weixin.qq.com/s/jUQHnATSiOpKfDeY_vQ6YA
•淘宝⽹的推荐算法具体是怎么样的? - xiao ma的回答 - 知乎 https:// www.zhihu.com/question/29108284/answer/43247127
•双⼗⼀⼿淘⾸页个性分享 https://mp.weixin.qq.com/s/vpxLTcwenvlIvj5D-8uolg
•淘宝天猫个性化推荐技术演进史 https://blog.csdn.net/broadview2006/article/ details/71455437
•深度解析京东个性化推荐系统演进史 https://blog.csdn.net/qq_40027052/ article/details/78733365
•今⽇头条推荐算法原理 http://www.sohu.com/a/217314007_297710
数据和代码汇总
阿⾥天池数据集合https://tianchi.aliyun.com/datalab/index.htm?spm=5176.100073.0.0.21316fc1Q34jZU
•CTR预估代码汇总 https://github.com/shenweichen/DeepCTR
•CTR-CVR相关模型 https://arxiv.org/abs/1804.07931
•Movielens推荐 https://github.com/chengstone/movie_recommender
•随⼿看到的LTR代码:https://github.com/shiba24/learning2rank
课后作业
运⾏MF的movielens notebook,⽤notebook,改改⽹络结构,找到调模型感觉
•学会使⽤Google、Github搜索引擎解决问题、查找论⽂和代码
•熟悉天池数据平台,了解如何使⽤更贴近⼯业界的数据
预习资料
•2013 微软:Learning Deep Structured Semantic Models for Web Search using Clickthrough Data https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/cikm2013_DSSM_fullversion.pdf
•2016 Youtube :Deep Neural Networks for YouTube Recommendations https://research.google.com/pubs/archive/45530.pdf
•解读 Airbnb KDD2018 best paper: Embeddings at Airbnb - 吴海波的⽂章 - 知乎 https://zhuanlan.zhihu.com/p/49537461