原文:

Next Item Recommendation with Self-Attention

Introdution

本文提出了一種基於 self-attention 的基於序列的推薦演算法

,利用

self-attention

來為使用者短期行為模式的依賴關係和重要性建模。同時該模型也保留了使用者的長久興趣。整個網路在

metric learning

的框架下,是

第一次將 self-attention 和 metric learning的結合的嘗試。

實驗結果表明,透過

self-attention

,模型可以很好的學習使用者的短期興趣愛好, 並且能有效的提升模型效果。透過和近期的文章得對比發現,該方法可以在很大程度上改善序列化推薦的效果。

《Next Item Recommendation with Self-Attention》閱讀筆記

模型結構

The proposed model:Attrec

AttRec

:由s

elf-attention model

collaborative metric learning model

組成:self-attention model 計算Item之間的依賴關係,為使用者短期意圖建模;collaborative metric learning model 計算user與Item之間的歐式距,為使用者長期偏好建模,結合兩個模組為使用者推薦t+1時的Item。

1.Short-Term Intents Modelling with Self-Attention

《Next Item Recommendation with Self-Attention》閱讀筆記

self-attention

不同於基本的attention,self-attention不僅能保持上下文相關的序列資訊,也能捕獲序列內元素的關係,學習到序列內部結構

Query = Key = Value

將每個Item embedding到一個d維向量,

《Next Item Recommendation with Self-Attention》閱讀筆記

《Next Item Recommendation with Self-Attention》閱讀筆記

item iteracted with user at time step t

使用一個幾何序列的時間尺度來新增不同頻率的正弦訊號到

Query

Key

,使序列保持時序性,時間嵌入(TE)由兩個正弦訊號組成

《Next Item Recommendation with Self-Attention》閱讀筆記

透過具有共享引數的非線性變換,將

Query

Key

投射到同一個空間中,線性整流函式是一個啟用函式,為模型引入非線性特徵

《Next Item Recommendation with Self-Attention》閱讀筆記

WQ/WK:權重矩陣

輸出關聯矩陣S,表徵L個Item之間的相似性,並將權重歸一化

《Next Item Recommendation with Self-Attention》閱讀筆記

Value

做恆等變換,若使用線性變換會增加獲取實際引數的難度

《Next Item Recommendation with Self-Attention》閱讀筆記

輸出

a_{t}^{u}

被看作是使用者短期意圖的表達,使用mean embedding將L self-attention聚合為single attentive representations

《Next Item Recommendation with Self-Attention》閱讀筆記

2.User Long-Term Preference Modelling

使用U

\in

R^{M\times d}

和 V

\in

R^{N\times d}

來表示

user

Item

的latent factor 矩陣,並計算他們之間的歐氏距,距離越小則代表使用者越傾向與這個item。

Metric embedding

適用與處理稀疏的資料和未觀測到的資料,能夠避開dot-product違背矩陣函式的重要不等式性質導致次優解的缺點

《Next Item Recommendation with Self-Attention》閱讀筆記

Model learning

模型任務是基於time step t 和 使用者長期偏好給出t+1時刻的推薦(denoted by

H_{t+1}^{u}

),使用歐氏距為短期和長期影響建模,將值相加為最後的推薦打分

《Next Item Recommendation with Self-Attention》閱讀筆記

《Next Item Recommendation with Self-Attention》閱讀筆記

使用

pairwise-ranking method

學習模型引數:user、正負樣本對組成的triple得到的

《Next Item Recommendation with Self-Attention》閱讀筆記

為引數計算

margin-based hinge loss

,l2正則控制模型複雜度,adaptive gradient algorithm來做梯度下降(利用以前的梯度資訊判斷特徵I是否被更新,尤其適合稀疏矩陣)

《Next Item Recommendation with Self-Attention》閱讀筆記

EXPERIMENT

《Next Item Recommendation with Self-Attention》閱讀筆記

《Next Item Recommendation with Self-Attention》閱讀筆記