受限玻尔兹曼机(RBM)原理总结

简介:

 在前面我们讲到了深度学习的两类神经网络模型的原理,第一类是前向的神经网络,即DNN和CNN。第二类是有反馈的神经网络,即RNN和LSTM。今天我们就总结下深度学习里的第三类神经网络模型:玻尔兹曼机。主要关注于这类模型中的受限玻尔兹曼机(Restricted Boltzmann Machine,以下简称RBM), RBM模型及其推广在工业界比如推荐系统中得到了广泛的应用。

1. RBM模型结构

    玻尔兹曼机是一大类的神经网络模型,但是在实际应用中使用最多的则是RBM。RBM本身模型很简单,只是一个两层的神经网络,因此严格意义上不能算深度学习的范畴。不过深度玻尔兹曼机(Deep Boltzmann Machine,以下简称DBM)可以看做是RBM的推广。理解了RBM再去研究DBM就不难了,因此本文主要关注于RBM。

    回到RBM的结构,它是一个个两层的神经网络,如下图所示:

    上面一层神经元组成隐藏层(hidden layer), 用h" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">h h 向量隐藏层神经元的值。下面一层的神经元组成可见层(visible layer),用v" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">v v 向量表示可见层神经元的值。隐藏层和可见层之间是全连接的,这点和DNN类似, 隐藏层神经元之间是独立的,可见层神经元之间也是独立的。连接权重可以用矩阵W" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">W W 表示。和DNN的区别是,RBM不区分前向和反向,可见层的状态可以作用于隐藏层,而隐藏层的状态也可以作用于可见层。隐藏层的偏倚系数是向量b" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">b b ,而可见层的偏倚系数是向量a" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">a a

    常用的RBM一般是二值的,即不管是隐藏层还是可见层,它们的神经元的取值只为0或者1。本文只讨论二值RBM。

    总结下RBM模型结构的结构:主要是权重矩阵W" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">W W , 偏倚系数向量a" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">a a b" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">b b ,隐藏层神经元状态向量h" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">h h 和可见层神经元状态向量v" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">v v

2. RBM概率分布

    RBM是基于基于能量的概率分布模型。怎么理解呢?分两部分理解,第一部分是能量函数,第二部分是基于能量函数的概率分布函数。

    对于给定的状态向量h" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">h h v" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">v v ,则RBM当前的能量函数可以表示为:

E(v,h)=−aTv−bTh−hTWv" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">E(v,h)=aTvbThhTWv E ( v , h ) = − a T v − b T h − h T W v

    有了能量函数,则我们可以定义RBM的状态为给定v,h" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">v,h v , h 的概率分布为:

P(v,h)=1Ze−E(v,h)" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">P(v,h)=1ZeE(v,h) P ( v , h ) = 1 Z e − E ( v , h )

    其中Z" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">Z Z 为归一化因子,类似于softmax中的归一化因子,表达式为:

Z=∑v,he−E(v,h)" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">Z=v,heE(v,h) Z = ∑ v , h e − E ( v , h )

    有了概率分布,我们现在来看条件分布P(h|v)" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">P(h|v) P ( h | v ) :

(1)P(h|v)=P(h,v)P(v)(2)=1P(v)1Zexp{ aTv+bTh+hTWv}(3)=1Z′exp{ bTh+hTWv}(4)=1Z′exp{ ∑j=1nh(bjThj+hjTWj,:v)}(5)=1Z′∏j=1nhexp{ bjThj+hjTWj,:v}" role="presentation" style="margin: 0px; padding: 0px; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative; display: table-cell !important; width: 10000em !important;">P(h|v)=P(h,v)P(v)=1P(v)1Zexp{ aTv+bTh+hTWv}=1Zexp{ bTh+hTWv}=1Zexp{ j=1nh(bTjhj+hTjWj,:v)}=1Zj=1nhexp{ bTjhj+hTjWj,:v}(1)(2)(3)(4)(5) (1) P ( h | v ) = P ( h , v ) P ( v ) (2) = 1 P ( v ) 1 Z e x p { a T v + b T h + h T W v } (3) = 1 Z ′ e x p { b T h + h T W v } (4) = 1 Z ′ e x p { ∑ j = 1 n h ( b j T h j + h j T W j , : v ) } (5) = 1 Z ′ ∏ j = 1 n h e x p { b j T h j + h j T W j , : v }

    其中Z′" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">Z Z ′ 为新的归一化系数,表达式为:

1Z′=1P(v)1Zexp{ aTv}" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">1Z=1P(v)1Zexp{ aTv} 1 Z ′ = 1 P ( v ) 1 Z e x p { a T v }

    同样的方式,我们也可以求出P(v|h)" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">P(v|h) P ( v | h ) ,这里就不再列出了。

    有了条件概率分布,现在我们来看看RBM的激活函数,提到神经网络,我们都绕不开激活函数,但是上面我们并没有提到。由于使用的是能量概率模型,RBM的基于条件分布的激活函数是很容易推导出来的。我们以P(hj=1|v)" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">P(hj=1|v) P ( h j = 1 | v ) 为例推导如下。

(6)P(hj=1|v)=P(hj=1|v)P(hj=1|v)+P(hj=0|v)(7)=exp{ bj+Wj,:v}exp{ 0}+exp{ bj+Wj,:v}(8)=11+exp{ −(bj+Wj,:v)}(9)=sigmoid(bj+Wj,:v)" role="presentation" style="margin: 0px; padding: 0px; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative; display: table-cell !important; width: 10000em !important;">P(hj=1|v)=P(hj=1|v)P(hj=1|v)+P(hj=0|v)=exp{ bj+Wj,:v}exp{ 0}+exp{ bj+Wj,:v}=11+exp{ (bj+Wj,:v)}=sigmoid(bj+Wj,:v)(6)(7)(8)(9) (6) P ( h j = 1 | v ) = P ( h j = 1 | v ) P ( h j = 1 | v ) + P ( h j = 0 | v ) (7) = e x p { b j + W j , : v } e x p { 0 } + e x p { b j + W j , : v } (8) = 1 1 + e x p { − ( b j + W j , : v ) } (9) = s i g m o i d ( b j + W j , : v )

    从上面可以看出, RBM里从可见层到隐藏层用的其实就是sigmoid激活函数。同样的方法,我们也可以得到隐藏层到可见层用的也是sigmoid激活函数。即:

P(vj=1|h)=sigmoid(aj+W:,jTh)" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">P(vj=1|h)=sigmoid(aj+WT:,jh) P ( v j = 1 | h ) = s i g m o i d ( a j + W : , j T h )

    有了激活函数,我们就可以从可见层和参数推导出隐藏层的神经元的取值概率了。对于0,1取值的情况,则大于0.5即取值为1。从隐藏层和参数推导出可见的神经元的取值方法也是一样的。

3. RBM模型的损失函数与优化

    RBM模型的关键就是求出我们模型中的参数W,a,b" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">W,a,b W , a , b 。如果求出呢?对于训练集的m个样本,RBM一般采用对数损失函数,即期望最小化下式:

L(W,a,b)=−∑i=1mln(P(V(i)))" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">L(W,a,b)=i=1mln(P(V(i))) L ( W , a , b ) = − ∑ i = 1 m l n ( P ( V ( i ) ) )

    对于优化过程,我们是首先想到的当然是梯度下降法来迭代求出W,a,b" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">W,a,b W , a , b 。我们首先来看单个样本的梯度计算, 单个样本的损失函数为:−ln(P(V))" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">ln(P(V)) − l n ( P ( V ) ) , 我们先看看−ln(P(V))" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">ln(P(V)) − l n ( P ( V ) ) 具体的内容, :

(10)−ln(P(V))=−ln(1Z∑he−E(V,h))(11)=lnZ−ln(∑he−E(V,h))(12)=ln(∑v,he−E(v,h))−ln(∑he−E(V,h))" role="presentation" style="margin: 0px; padding: 0px; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative; display: table-cell !important; width: 10000em !important;">ln(P(V))=ln(1ZheE(V,h))=lnZln(heE(V,h))=ln(v,heE(v,h))ln(heE(V,h))(10)(11)(12) (10) − l n ( P ( V ) ) = − l n ( 1 Z ∑ h e − E ( V , h ) ) (11) = l n Z − l n ( ∑ h e − E ( V , h ) ) (12) = l n ( ∑ v , h e − E ( v , h ) ) − l n ( ∑ h e − E ( V , h ) )

    注意,这里面V" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">V V 表示的是某个特定训练样本,而v" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">v v 指的是任意一个样本。

    我们以ai" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">ai a i 的梯度计算为例:

(13)∂(−ln(P(V)))∂ai=1∂ai∂ln(∑v,he−E(v,h))−1∂ai∂ln(∑he−E(V,h))(14)=−1∑v,he−E(v,h)∑v,he−E(v,h)∂E(v,h)∂ai+1∑he−E(V,h)∑he−E(V,h)∂E(V,h)∂ai(15)=∑hP(h|V)∂E(V,h)∂ai−∑v,hP(h,v)∂E(v,h)∂ai(16)=−∑hP(h|V)Vi+∑v,hP(h,v)vi(17)=−∑hP(h|V)Vi+∑vP(v)∑hP(h|v)vi(18)=∑vP(v)vi−Vi" role="presentation" style="margin: 0px; padding: 0px; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative; display: table-cell !important; width: 10000em !important;">(ln(P(V)))ai=1ailn(v,heE(v,h))1ailn(heE(V,h))=1v,heE(v,h)v,heE(v,h)E(v,h)ai+1heE(V,h)heE(V,h)E(V,h)ai=hP(h|V)E(V,h)aiv,hP(h,v)E(v,h)ai=hP(h|V)Vi+v,hP(h,v)vi=hP(h|V)Vi+vP(v)hP(h|v)vi=vP(v)viVi(13)(14)(15)(16)(17)(18) (13) ∂ ( − l n ( P ( V ) ) ) ∂ a i = 1 ∂ a i ∂ l n ( ∑ v , h e − E ( v , h ) ) − 1 ∂ a i ∂ l n ( ∑ h e − E ( V , h ) ) (14) = − 1 ∑ v , h e − E ( v , h ) ∑ v , h e − E ( v , h ) ∂ E ( v , h ) ∂ a i + 1 ∑ h e − E ( V , h ) ∑ h e − E ( V , h ) ∂ E ( V , h ) ∂ a i (15) = ∑ h P ( h | V ) ∂ E ( V , h ) ∂ a i − ∑ v , h P ( h , v ) ∂ E ( v , h ) ∂ a i (16) = − ∑ h P ( h | V ) V i + ∑ v , h P ( h , v ) v i (17) = − ∑ h P ( h | V ) V i + ∑ v P ( v ) ∑ h P ( h | v ) v i (18) = ∑ v P ( v ) v i − V i

    其中用到了:

∑hP(h|v)=1∑hP(h|V)=1" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">hP(h|v)=1hP(h|V)=1 ∑ h P ( h | v ) = 1 ∑ h P ( h | V ) = 1

    同样的方法,可以得到W,b" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">W,b W , b 的梯度。这里就不推导了,直接给出结果:

∂(−ln(P(V)))∂bi=∑vP(v)P(hi=1|v)−P(hi=1|V)" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">(ln(P(V)))bi=vP(v)P(hi=1|v)P(hi=1|V) ∂ ( − l n ( P ( V ) ) ) ∂ b i = ∑ v P ( v ) P ( h i = 1 | v ) − P ( h i = 1 | V )
∂(−ln(P(V)))∂Wij=∑vP(v)P(hi=1|v)vj−P(hi=1|V)Vj" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; font-size: 12px; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">(ln(P(V)))Wij=vP(v)P(hi=1|v)vjP(hi=1|V)Vj ∂ ( − l n ( P ( V ) ) ) ∂ W i j = ∑ v P ( v ) P ( h i = 1 | v ) v j − P ( h i = 1 | V ) V j

    虽然梯度下降法可以从理论上解决RBM的优化,但是在实际应用中,由于概率分布的计算量大,因为概率分布有2nv+nh" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">2nv+nh 2 n v + n h 种情况, 所以往往不直接按上面的梯度公式去求所有样本的梯度和,而是用基于MCMC的方法来模拟计算求解每个样本的梯度损失再求梯度和,常用的方法是基于Gibbs采样的对比散度方法来求解,对于对比散度方法,由于需要MCMC的知识,这里就不展开了。对对比散度方法感兴趣的可以看参考文献中2的《A Practical Guide to Training Restricted Boltzmann Machines》,对于MCMC,后面我专门开篇来讲。

4. RBM在实际中应用方法

    大家也许会疑惑,这么一个模型在实际中如何能够应用呢?比如在推荐系统中是如何应用的呢?这里概述下推荐系统中使用的常用思路。

    RBM可以看做是一个编码解码的过程,从可见层到隐藏层就是编码,而反过来从隐藏层到可见层就是解码。在推荐系统中,我们可以把每个用户对各个物品的评分做为可见层神经元的输入,然后有多少个用户就有了多少个训练样本。由于用户不是对所有的物品都有评分,所以任意样本有些可见层神经元没有值。但是这不影响我们的模型训练。在训练模型时,对于每个样本,我们仅仅用有用户数值的可见层神经元来训练模型。

    对于可见层输入的训练样本和随机初始化的W,a" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">W,a W , a ,我们可以用上面的sigmoid激活函数得到隐藏层的神经元的0,1值,这就是编码。然后反过来从隐藏层的神经元值和W,b" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">W,b W , b 可以得到可见层输出,这就是解码。对于每个训练样本, 我们期望编码解码后的可见层输出和我们的之前可见层输入的差距尽量的小,即上面的对数似然损失函数尽可能小。按照这个损失函数,我们通过迭代优化得到W,a,b" role="presentation" style="margin: 0px; padding: 0px; display: inline; line-height: normal; word-spacing: normal; word-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; position: relative;">W,a,b W , a , b ,然后对于某个用于那些没有评分的物品,我们用解码的过程可以得到一个预测评分,取最高的若干评分对应物品即可做用户物品推荐了。

    如果大家对RBM在推荐系统的应用具体内容感兴趣,可以阅读参考文献3中的《Restricted Boltzmann Machines for Collaborative Filtering

5. RBM推广到DBM

    RBM很容易推广到深层的RBM,即我们的DBM。推广的方法就是加入更多的隐藏层,比如一个三层的DBM如下:

    当然隐藏层的层数可以是任意的,随着层数越来越复杂,那模型怎么表示呢?其实DBM也可以看做是一个RBM,比如下图的一个4层DBM,稍微加以变换就可以看做是一个DBM。

  将可见层和偶数隐藏层放在一边,将奇数隐藏层放在另一边,我们就得到了RBM,和RBM的细微区别只是现在的RBM并不是全连接的,其实也可以看做部分权重为0的全连接RBM。RBM的算法思想可以在DBM上使用。只是此时我们的模型参数更加的多,而且迭代求解参数也更加复杂了。

6. RBM小结

    RBM所在的玻尔兹曼机流派是深度学习中三大流派之一,也是目前比较热门的创新区域之一,目前在实际应用中的比较成功的是推荐系统。以后应该会有更多类型的玻尔兹曼机及应用开发出来,让我们拭目以待吧!


本文转自刘建平Pinard博客园博客,原文链接:http://www.cnblogs.com/pinard/p/6530523.html,如需转载请自行联系原作者


相关文章
|
7月前
|
SQL 监控 关系型数据库
SQL优化技巧:让MySQL查询快人一步
本文深入解析了MySQL查询优化的核心技巧,涵盖索引设计、查询重写、分页优化、批量操作、数据类型优化及性能监控等方面,帮助开发者显著提升数据库性能,解决慢查询问题,适用于高并发与大数据场景。
|
10月前
|
机器学习/深度学习 存储 并行计算
了解集合通信与模型并行策略
了解集合通信基础概念及常见的集合通信原语;以及大模型并行策略:包括数据并行、流水并行、张量并行和专家并行。
了解集合通信与模型并行策略
|
机器学习/深度学习 传感器 人工智能
《AI赋能星际探索:机器人如何开启宇宙新征程!》
人工智能(AI)正革新空间探索机器人技术,提升其在复杂宇宙环境中的操作能力。AI助力精准导航与路径规划,使机器人能自主分析环境、避开危险;实现复杂任务的自主决策,如设备维修和样本采集;高效处理海量数据,快速提取有价值信息;优化人机协作模式,增强宇航员与机器人之间的默契。这些进步大幅提高了空间探索的效率和安全性,为人类揭开宇宙奥秘提供了强有力的支持。
614 4
|
Shell 开发工具 git
把git-bash添加到右键菜单中
记得第一次安装git的时候,就是因为Git安装的时候会默认一次性Git Bash Here,Git GUI Here等三个会一起出现,而本人由于洁癖就卸载了重新安装了一次拒绝添加右键菜单的行为。 然而再开发途中,回到桌面点exe再cd命令到该文件夹,着实麻烦,于是懒癌战胜洁癖,开始着手了。
424 0
|
存储 JSON 监控
FastAPI日志之谜:如何揭开Web应用监控与调试的面纱?
【8月更文挑战第31天】在现代Web开发中,日志记录对于监控应用状态、诊断问题和了解用户行为至关重要。FastAPI框架提供了强大的日志功能,使开发者能轻松集成日志记录。本文将详细介绍如何在FastAPI中设置和利用日志,包括基础配置、请求响应日志、错误处理和结构化日志等内容,帮助提升应用的可维护性和性能。
828 0
|
机器学习/深度学习 算法 PyTorch
卷积神经网络(CNN)——基础知识整理
卷积神经网络(CNN)——基础知识整理
855 2
|
存储 NoSQL 数据库
知识图谱调研-Freebase
介绍 Freebase 是一个由元数据组成的大型合作知识库,内容主要来自其社区成员的贡献。它整合了许多网上的资源,包括部分私人wiki站点中的内容。Freebase 致力于打造一个允许全球所有人(和机器)快捷访问的资源库,由美国软件公司Metaweb开发并于2007年3月公开运营。2010年7月16日被Google收购, 2014年12月16日,Google宣布将在六个月后关闭 Freebase
21064 0
|
数据安全/隐私保护 iOS开发 Docker
|
缓存 Java API
OKHttp详解
OKHttp详解
|
机器学习/深度学习 人工智能 算法
python数据分析——数据分析的数据模型
数据分析的数据模型是决策支持系统的重要组成部分,它通过对大量数据的收集、整理、分析和挖掘,为企业提供有价值的信息,以支持企业的战略规划和日常运营。数据模型的选择和应用,直接关系到数据分析的准确性和有效性,进而影响企业的决策质量和市场竞争力。
705 0