《xDeepFM: Combining Explicit and Implicit Feature Interactions for Recommender Systems》对xDeepFM模型的理解

如果不了解FM模型或者FFM模型或者DeepFM模型可以查阅下面三篇文章:

1、推荐系统 | 《Factorization Machines》 | FM模型及python实现

2、《Field-aware Factorization Machines for CTR Prediction》FFM模型整理及python代码

3、《DeepFM: A Factorization-Machine based Neural Network for CTR Prediction》 DeepFM 模型及python代码

1 原文

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2 xDeepFM模型

2.1 背景

2016年出现了wide&deep、fnn和pnn等模型。

Wide&Deep模型中,Wide部分是手动特征交叉(负责memorization),Deep部分利用DNN来实现高阶特征交叉(负责generalization),Wide部分和Deep部分一起训练。FNN比较暴力,直接使用预训练的FM的隐向量传给mlp。PNN则是先做特征交叉然后给DNN处理。FNN和PNN这两种方法的缺点就是忽视了低阶特征交叉。

2017年出现了DeepFM、Deep&Cross和NFM等模型。

DeepFM模型和Deep&Cross以及xDeepFM都可以认为是Wide&Deep的扩展。DeepFM和前面模型相比优势在于两点,一个是不再需要手工构建wide部分,另一个是相对于FNN把FM的隐向量参数直接作为网络参数学习。DeepFM将embedding层结果输入给FM和DNN,两者的输出共同作为分类器的输入,从而实现低阶和高阶特征交叉的目的。Deep&Cross和DeepFM类似,cross-network模块可以实现bounded-degree feature interactions。

2018年出现了xDeepFM模型,xDeepFFM是对Deep&Cross的改进,利用提出的CIN结构代替DCN结构。本文模型与FNN、PNN、DeepFM等不同。FNN、PNN、DeepFM等模型学习出的是隐式的交互特征,形式是未知的,而且它们的特征交互是发生在元素级(bit-wise)。xDeepFM学习的是显示的特征交互,特征交互发生在向量级(vector-wise) 。

什么是bit-wise与vector-wise??假设隐向量的维度为3维,如果两个特征(对应的向量分别为 ( a 1 , b 1 , c 1 ) (a1,b1,c1) (a1,b1,c1) ( a 2 , b 2 , c 2 ) (a2,b2,c2) (a2,b2,c2)的话)在进行交互时,交互的形式类似于 f ( w 1 ∗ a 1 ∗ a 2 , w 2 ∗ b 1 ∗ b 2 , w 3 ∗ c 1 ∗ c 2 ) f(w1 * a1 * a2,w2 * b1 * b2 ,w3 * c1 * c2) f(w1a1a2,w2b1b2,w3c1c2)的话,此时我们认为特征交互是发生在元素级(bit-wise)上。如果特征交互形式类似于 f ( w ∗ ( a 1 ∗ a 2 , b 1 ∗ b 2 , c 1 ∗ c 2 ) ) f(w * (a1 * a2 ,b1* b2,c1 * c2)) f(w(a1a2,b1b2,c1c2))的话,那么我们认为特征交互是发生在特征向量级(vector-wise)。

什么是显示特征交互与隐士特征交互??显式的特征交互和隐式的特征交互。以两个特征为例xi和xj,在经过一系列变换后,我们可以表示成 w i j ∗ ( x i ∗ x j ) wij *(xi * xj) wij(xixj)的形式,就可以认为是显式特征交互,否则的话,是隐式的特征交互。

2.2 相关知识

2.2.1 Embedding

对于[user_id=s02,gender=male,organization=msra,interests=comedy&rock],通过one-hot可以转换为如下形式:
在这里插入图片描述
在这里插入图片描述
m个 field 经过 embedding layer 后可以得到 e = [ e 1 , e 2 , . . . , e m ] e = [e1, e2, ..., em] e=[e1,e2,...,em],属性 i i i编码生成一个 e i ∈ R D ei \in R^D eiRD。 每个输入 feature 的长度可能不同,但是经过 Embedding 后长度均为 D ,所以他们 embeddings 长度均为 m ∗ D m*D mD

2.2.2 隐含的高阶交互

FNN,Deep Crossing以及Wide&Deep的深层部分利用 field embedding e e e上的前馈神经网络来学习高阶特征交互。
x 1 = σ ( W ( 1 ) e + b 1 ) x^1 = σ(W^(1)e + b^1) x1=σ(W(1)e+b1)
x k = σ ( W ( k ) x ( k − 1 ) + b k ) x^k = σ(W^{(k)}x^{(k−1)} + b^k) xk=σ(W(k)x(k1)+bk)
PNN和DeepFM除了在嵌入向量e上应用DNN之外,它们还在架构中添加了双向交互层。 因此,bit-wise和vector-wise相互作用都包含在他们的模型中。 PNN和DeepFM之间的主要区别在于PNN将FM层的输出连接到DNN,而DeepFM将FM层直接连接到输出单元。PNN 与 DeepFM 结构如下图所示,属于元素级(bit-wise)的特征交互,也可以理解为相同 field 中的 embedding vector 内的元素也会相互影响。
在这里插入图片描述

2.2.3 显示的高阶交互

Cross-Network如下图,Cross-Network旨在明确地模拟高阶特征交互。 与传统的完全连接的前馈网络不同,隐藏层通过以下交叉操作计算:
x k = x 0 x k − 1 T w k + b k + x k − 1 x_k = x_0x^T_{ k−1}w_k + b_k + x_{k−1} xk=x0xk1Twk+bk+xk1
在这里插入图片描述
作者认为CrossNet学习了一种特殊类型的高阶特征交互,其中CrossNet中的每个隐藏层都是x0的标量倍数。并给出了证明:
k = 1 k = 1 k=1时:
x 1 = x 0 ( x 0 T w 1 ) + x 0 = x 0 ( x 0 T w 1 + 1 ) = α 1 x 0 x_1 = x_0(x^T _0 w_1) + x_0 = x_0(x^T _0 w_1 + 1) = α^1x_0 x1=x0(x0Tw1)+x0=x0(x0Tw1+1)=α1x0
x 1 x_1 x1可以表示成 x 0 x_0 x0 α 1 α^1 α1倍。 x 1 x_1 x1实际上是一个关于 x 0 x_0 x0的线性回归函数, α 1 α^1 α1也就是一个标量。扩展到 k = k + 1 k = k+1 k=k+1:
x i + 1 = x 0 x i T w i + 1 = x 0 ( ( α i x 0 ) w i + 1 ) + α i x 0 = α i + 1 x 0 x_{i+1}=x_0x_i^Tw_{i+1}=x_0((\alpha^ix_0)w_{i+1})+\alpha^ix_0=\alpha^{i+1}x_0 xi+1=x0xiTwi+1=x0((αix0)wi+1)+αix0=αi+1x0
α i + 1 α^{i+1} αi+1也就是一个标量,就相当于$x_0 $不断乘以一个数。

作者认为这个模型有以下两个缺点:(1)CrossNet的输出以特殊形式限制,每个隐藏层是 x 0 x_0 x0的标量倍数; (2)互动以 bit-wise 方式进行。

2.2.4 Compressed Interaction Network

考虑到DCN的不足,作者提出的CIN模型如下图所示,有以下特点:(1)相互作用在 vector-wise方面应用,而不是在 bit-wise水平上应用; (2)明确测量高阶特征相互作用; (3)网络的复杂性不会随着交互程度呈指数级增长。
在这里插入图片描述
CIN应用向量维度,而不再是之前DCN模型的标量,每层计算的公式为:
X h , ∗ k = ∑ i = 1 H k − 1 ∑ j = 1 m W i j k , h ( X i , ∗ k − 1 ∘ X j , ∗ 0 ) X_{h,*}^k = \sum_{i=1}^{H_{k-1}}\sum_{j=1}^m{W_{ij}^{k,h}(X_{i,*}^{k-1} \circ X_{j,*}^0)} Xh,k=i=1Hk1j=1mWijk,h(Xi,k1Xj,0)
对于点乘部分,举了一个小例子: &lt; a 1 , a 2 , a 3 &gt; ∘ &lt; b 1 , b 2 , b 3 &gt; = &lt; a 1 b 1 , a 2 b 2 , a 3 b 3 &gt; &lt;a_1,a_2,a_3&gt;\circ&lt;b_1,b_2,b_3&gt;=&lt;a_1b_1,a_2b_2,a_3b_3&gt; <a1,a2,a3><b1,b2,b3>=<a1b1,a2b2,a3b3>

k k k层隐层含有 H k H_k Hk条神经元向量。隐层的计算可以分成两个步骤:

(1)图(a)表示 ∘ \circ 过程,根据前一层隐层的状态 x k x^k xk和原特征矩阵 x 0 x^0 x0,计算出一个中间结果 z k + 1 z^{k+1} zk+1,它是一个三维的张量。
(2)图b表示feature map过程, 用 H k + 1 用H_{k+1} Hk+1个尺寸为 m ∗ H k m*H_k mHk的卷积核生成下一层隐层的状态。这一操作与计算机视觉中最流行的卷积神经网络大体是一致的,唯一的区别在于卷积核的设计。CIN中一个神经元相关的接受域是垂直于特征维度D的整个平面,而CNN中的接受域是当前神经元周围的局部小范围区域,因此CIN中经过卷积操作得到的特征图是一个向量,而不是一个矩阵。下图可以方便理解该过程。
在这里插入图片描述
图(c)给出了CIN的整体结构,中间部分相当于是不同深度的图(b),对于生成的每个feature map都进行sum pooling,求和会将特征进行叠加。 从而实现输出单元可以得到不同阶数的特征交互模式。CIN的结构与RNN是很类似的,即每一层的状态是由前一层隐层的值与一个额外的输入数据计算所得。

作者给出了CIN模型为什么是显示的高阶交互,相关证明可以看原文中的公式(10)(11)(12)。

2.3 xDeepFM

如下图所示,xDeepFM将linear模型、CIN模型、Deep模型的输出单元组合在一起作为output unit 的输入。
在这里插入图片描述
output unit 的输出结果为: y ˆ = σ ( w l i n e a r T a + w d n n T x d n n k + w c i n T p + + b ) y ˆ = σ(w^T_{linear} a + w^T_{dnn}x_{dnn}^k + w^T_{cin}p^++ b) yˆ=σ(wlinearTa+wdnnTxdnnk+wcinTp++b)
模型的损失函数为: L = − 1 / N ∑ i = 1 N y i l o g y ˆ i + ( 1 − y i ) l o g ( 1 − y ˆ i ) L = - 1/N\sum_{i=1}^Ny_ilogyˆ_i + (1 − y_i)log(1 − y ˆi) L=1/Ni=1Nyilogyˆi+(1yi)log(1yˆi)

2.4 实验

1、各个独立模型在数据集上的表现
在这里插入图片描述
2、集成模型的表现
在这里插入图片描述
3、网络深度、各层节点数、激活函数的影响
在这里插入图片描述

3 实验

查看参考文献2的代码即可

巨人的肩膀

1、原文链接:https://arxiv.org/abs/1803.05170
2、作者给出的代码:https://github.com/Leavingseason/xDeepFM
3、https://www.jianshu.com/p/b4128bc79df0
4、https://blog.csdn.net/roguesir/article/details/80106672
5、https://zhuanlan.zhihu.com/p/35578626

Robust controller design involves the synthesis of a controller that can handle uncertainties and disturbances in a system. This is typically done by formulating the problem as an optimization problem, where the goal is to find a controller that minimizes a cost function subject to constraints. One approach to robust controller design involves combining prior knowledge with data. Prior knowledge can come from physical laws, engineering principles, or expert knowledge, and can help to constrain the search space for the controller design. Data, on the other hand, can provide information about the behavior of the system under different conditions, and can be used to refine the controller design. The combination of prior knowledge and data can be done in a number of ways, depending on the specific problem and the available information. One common approach is to use a model-based design approach, where a mathematical model of the system is used to design the controller. The model can be based on physical laws, or it can be derived from data using techniques such as system identification. Once a model is available, prior knowledge can be incorporated into the controller design by specifying constraints on the controller parameters or the closed-loop system response. For example, if it is known that the system has a certain level of damping, this can be used to constrain the controller design to ensure that the closed-loop system response satisfies this requirement. Data can be used to refine the controller design by providing information about the uncertainties and disturbances that the system is likely to encounter. This can be done by incorporating data-driven models, such as neural networks or fuzzy logic systems, into the controller design. These models can be trained on data to capture the nonlinearities and uncertainties in the system, and can be used to generate control signals that are robust to these uncertainties. Overall, combining prior knowledge and data is a powerful approach to robust controller design, as it allows the designer to leverage both physical principles and empirical data to design a controller that is robust to uncertainties and disturbances.
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值