Zhou G, Mou N, Fan Y, et al. Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, 2018.
https://github.com/mouna99/dien
对于CTR预测模型,很有必要捕捉用户兴趣的转移。因此设计了 interest extractor layer 从历史序列中捕捉用户暂时的兴趣。在训练的每一步中,我们为 interest extractor layer 引入了辅助loss。在 interest extractor layer 中加入了attention机制。
遵循用户的兴趣是导致一系列行为的原因,我们设计了辅助 loss,用下一个行为来训练当前的 hidden state(称之为 interest states)。这样有助于捕捉更多的语义信息并且是的GRU更高效的表征兴趣。
基于由 interest extractor layer 提取的兴趣序列,设计了GRU with attentional update gate (AUGRU),增强在兴趣变化中相关兴趣的影响,减弱不相关兴趣的影响。
用 GRU 的原因是因为它既可以避免梯度消失,有比 LSTM 速度快。GRU的表达为:
u t = σ ( W u i t + U u h t − 1 + b u ) u_t=\sigma(W^ui_t+U^uh_{t-1}+b^u) ut=σ(Wuit+Uuht−1+bu)
r t = σ ( W r i t + U r h t − 1 + b r ) r_t=\sigma(W^ri_t+U^rh_{t-1}+b^r) rt=σ(Writ+Urht−1+br)
h ~ t = t a n h ( W h i t + r t ∘ U h h t − 1 + b h ) \tilde{h}_t=tanh(W^hi_t+r_t\circ U^hh_{t-1}+b^h) h~t=tanh(Whit+rt∘Uhht−1+bh)
h t = ( 1 − u t ) ∘ h t − 1 + u t ∘ h ~ t h_t=(1-u_t)\circ h_{t-1}+u_t\circ\tilde{h}_t ht=(1−ut)∘ht−1+ut∘h~t
u t u_t ut相当于遗忘门,控制更新 h t h_t ht的程度, r t r_t rt控制前一时刻对这一时刻的影响, h ~ t \tilde{h}_t h~t表示这一时刻的更新状态, h t h_t ht表示隐藏状态。
如果只用最后的click结果当作是 label,那么GRU不能得到充分的训练,因为用户的兴趣是导致一系列行为的原因,用下一个行为来训练当前的 hidden state,下一个行为当作是正样本,并随机负采样,当作是负样本
L a u x = − 1 N ( ∑ i = 1 N ∑ t [ l o g σ ( h t i , e b i [ t + 1 ] ) ) + l o g σ ( h t i , e b i [ t + 1 ] ) ) ] ) L_{aux}=-\frac{1}{N}(\sum_{i=1}^N\sum_t[log\sigma(h_t^i,e_b^i[t+1]))+log\sigma(h_t^i,e_b^i[t+1]))]) Laux=−N1(i=1∑Nt∑[logσ(hti,ebi[t+1]))+logσ(hti,ebi[t+1]))])
整个神经网络的损失函数为
L t a r g e t = − 1 N ( ∑ i = 1 N [ y l o g p ( x ) + ( 1 − y ) l o g ( 1 − p ( x ) ) ] ) L_{target}=-\frac{1}{N}(\sum_{i=1}^N[ylog~p(x)+(1-y)log~(1-p(x))]) Ltarget=−N1(i=1∑N[ylog p(x)+(1−y)log (1−p(x))])
L = L t a r g e t + α L a u x L=L_{target}+\alpha L_{aux} L=Ltarget+αLaux
α \alpha α用来平衡 interest representation 和 CTR prediction。有辅助loss的帮助,每一个 hidden state 充分的训练成为了 represent interest state。
再点击序列中未必都是与最终结果相关的,我们需要增强在兴趣变化中相关兴趣的影响,减弱不相关兴趣的影响,所以给 GRU 增加 attention,权重因子
a t = e x p ( h t W e a ) ∑ j = 1 T e x p ( h j W e a ) a_t=\frac{exp(h_tWe_a)}{\sum_{j=1}^Texp(h_jWe_a)} at=∑j=1Texp(hjWea)exp(htWea)
其中 e a e_a ea为 concat of embedding vectors from fields in category ad。
下面介绍三种加 attention 的 GRU 模型