DIN

用户的兴趣是很多样的,基于候选商品只与用户的一部分兴趣有关,使用attention机制,对用户的不同行为的注意力是不一样的。

数据集问题:

review包含reviewerId(评论人的id),asin(商品ID),unixReviewTime(评论时间)

meta包含asin(商品ID),categories(类别,只包含最后一个类目)

meta_df中是按照asin排序,review_df是按照reviewid,unixreviewtime进行排序,cate_list是所有商品的categories构成的列表

Build_dataset:

每个正样例产生相同个数的负样例;

训练集为前i个item产生下一个item,添加一个正例添加一个负例

最后一个Item是目标

test_set中存储的是(reviewerId, history, (pos, neg))

train_set中存储的是(reviewerId, history, pos)

model:

先使用用户访问过的所有的item的embedding加和组合成用户的embedding表示

损失函数时sigmoid_cross_entropy_with_logits

需要训练的参数包含

<tf.Variable 'user_emb_w:0' shape=(192403, 128) dtype=float32_ref>

<tf.Variable 'item_emb_w:0' shape=(63001, 64) dtype=float32_ref>

 <tf.Variable 'item_b:0' shape=(63001,) dtype=float32_ref>

<tf.Variable 'cate_emb_w:0' shape=(801, 64) dtype=float32_ref>,

<tf.Variable 'batch_normalization/beta:0' shape=(128,) dtype=float32_ref>

<tf.Variable 'batch_normalization/gamma:0' shape=(128,) dtype=float32_ref>

<tf.Variable 'dense/kernel:0' shape=(128, 128) dtype=float32_ref>

<tf.Variable 'dense/bias:0' shape=(128,) dtype=float32_ref>  #将用户访问过的item的embedding压缩到一起

 <tf.Variable 'b1/beta:0' shape=(256,) dtype=float32_ref>

<tf.Variable 'b1/gamma:0' shape=(256,) dtype=float32_ref>

<tf.Variable 'f1/kernel:0' shape=(256, 80) dtype=float32_ref>

<tf.Variable 'f1/bias:0' shape=(80,) dtype=float32_ref>

<tf.Variable 'f2/kernel:0' shape=(80, 40) dtype=float32_ref>

<tf.Variable 'f2/bias:0' shape=(40,) dtype=float32_ref>

<tf.Variable 'f3/kernel:0' shape=(40, 1) dtype=float32_ref>

<tf.Variable 'f3/bias:0' shape=(1,) dtype=float32_ref>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。