当前位置:   article > 正文

推荐系统_常见的推荐系统架构构造_normadj算法

normadj算法

1:BPR
BPR: Bayesian Personalized Ranking from Implicit Feedback.
BPR is a basic matrix factorization model that be trained in the pairwise way.
请添加图片描述
定义各个层和损失
对user进行embedding

self.user_embedding =  nn.Embedding(self.n_users, self.embedding_size)
  • 1

对item进行embedding

self.item_embedding = nn.Embedding(self.n_items, self.embedding_size)
  • 1

损失定义

 self.loss = BPRLoss()
  • 1

2:xDeepFM
xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems.
xDeepFM combines a CIN (Compressed Interaction Network) with a classical DNN.The model is able to learn certain bounded-degree feature interactions explicitly; Besides, it can also learn arbitrary low- and high-order feature interactions implicitly.
请添加图片描述
构建CIN模块,CIN结合了RNN和CNN的思想,一共构建三层。
第一个卷积层

conv1d = nn.Conv1d(self.field_nums[-1] * self.field_nums[0], layer_size, 1).to(self.device)
  • 1

Conv1d()函数中需要传入输入通道,输出通道,以及卷积核。在第一个Conv1d中8*8=64通道,输出为100通道。
第一个卷积层

conv1d = nn.Conv1d(self.field_nums[-1] * self.field_nums[0], layer_size, 1).to(self.device)
  • 1

在第二个Conv1d中50*8=400通道,输出为100通道。

conv1d = nn.Conv1d(self.field_nums[-1] * self.field_nums[0], layer_size, 1).to(self.device)
  • 1

在第三个Conv1d中50*8=400通道,输出为100通道。
定义MPL层一共三个循环:每个循环进行Dropout,Linear,activation。

 mlp_modules.append(nn.Dropout(p=self.dropout))
 mlp_modules.append(nn.Linear(input_size, output_size))
 activation_func = activation_layer
  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/375279
推荐阅读
相关标签
  

闽ICP备14008679号