PMF

                版权声明:本文为我很帅的原创文章,想要转载联系我哦。                    https://blog.csdn.net/u010111016/article/details/50822550                </div>
                      <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-cd6c485e8b.css">
                          <div id="content_views" class="markdown_views prism-atom-one-dark">
        <!-- flowchart 箭头图标 勿删 -->
        <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
          <path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path>
        </svg>
        <p><strong>上一篇博客讲到了推荐系统中常用的矩阵分解方法,<span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-7343-Frame" tabindex="0" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mi>R</mi><mi>e</mi><mi>g</mi><mi>u</mi><mi>l</mi><mi>a</mi><mi>r</mi><mi>i</mi><mi>z</mi><mi>e</mi><mi>d</mi><mi>M</mi><mi>F</mi></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-1" style="width: 8.953em; display: inline-block;"><span style="display: inline-block; position: relative; width: 7.153em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.453em, 1007.15em, 2.652em, -999.998em); top: -2.298em; left: 0em;"><span class="mrow" id="MathJax-Span-2"><span class="mi" id="MathJax-Span-3" style="font-family: MathJax_Math-italic;">R</span><span class="mi" id="MathJax-Span-4" style="font-family: MathJax_Math-italic;">e</span><span class="mi" id="MathJax-Span-5" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-6" style="font-family: MathJax_Math-italic;">u</span><span class="mi" id="MathJax-Span-7" style="font-family: MathJax_Math-italic;">l</span><span class="mi" id="MathJax-Span-8" style="font-family: MathJax_Math-italic;">a</span><span class="mi" id="MathJax-Span-9" style="font-family: MathJax_Math-italic;">r</span><span class="mi" id="MathJax-Span-10" style="font-family: MathJax_Math-italic;">i</span><span class="mi" id="MathJax-Span-11" style="font-family: MathJax_Math-italic;">z<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-12" style="font-family: MathJax_Math-italic;">e</span><span class="mi" id="MathJax-Span-13" style="font-family: MathJax_Math-italic;">d<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-14" style="font-family: MathJax_Math-italic;">M<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span><span class="mi" id="MathJax-Span-15" style="font-family: MathJax_Math-italic;">F<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.302em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.309em; border-left: 0px solid; width: 0px; height: 1.253em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>R</mi><mi>e</mi><mi>g</mi><mi>u</mi><mi>l</mi><mi>a</mi><mi>r</mi><mi>i</mi><mi>z</mi><mi>e</mi><mi>d</mi><mi>M</mi><mi>F</mi></math></span></span><script type="math/tex" id="MathJax-Element-7343">Regularized MF</script>是对<span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-7344-Frame" tabindex="0" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mi>B</mi><mi>a</mi><mi>s</mi><mi>i</mi><mi>c</mi><mi>M</mi><mi>F</mi></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-16" style="width: 5.452em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.353em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.453em, 1004.35em, 2.452em, -999.998em); top: -2.298em; left: 0em;"><span class="mrow" id="MathJax-Span-17"><span class="mi" id="MathJax-Span-18" style="font-family: MathJax_Math-italic;">B</span><span class="mi" id="MathJax-Span-19" style="font-family: MathJax_Math-italic;">a</span><span class="mi" id="MathJax-Span-20" style="font-family: MathJax_Math-italic;">s</span><span class="mi" id="MathJax-Span-21" style="font-family: MathJax_Math-italic;">i</span><span class="mi" id="MathJax-Span-22" style="font-family: MathJax_Math-italic;">c</span><span class="mi" id="MathJax-Span-23" style="font-family: MathJax_Math-italic;">M<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span><span class="mi" id="MathJax-Span-24" style="font-family: MathJax_Math-italic;">F<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.302em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.059em; border-left: 0px solid; width: 0px; height: 1.003em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>B</mi><mi>a</mi><mi>s</mi><mi>i</mi><mi>c</mi><mi>M</mi><mi>F</mi></math></span></span><script type="math/tex" id="MathJax-Element-7344">Basic MF</script>的优化,而<span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-7345-Frame" tabindex="0" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mi>P</mi><mi>M</mi><mi>F</mi></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-25" style="width: 3.202em; display: inline-block;"><span style="display: inline-block; position: relative; width: 2.552em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.453em, 1002.55em, 2.452em, -999.998em); top: -2.298em; left: 0em;"><span class="mrow" id="MathJax-Span-26"><span class="mi" id="MathJax-Span-27" style="font-family: MathJax_Math-italic;">P<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span><span class="mi" id="MathJax-Span-28" style="font-family: MathJax_Math-italic;">M<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span><span class="mi" id="MathJax-Span-29" style="font-family: MathJax_Math-italic;">F<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.302em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.059em; border-left: 0px solid; width: 0px; height: 1.003em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mi>M</mi><mi>F</mi></math></span></span><script type="math/tex" id="MathJax-Element-7345">PMF</script>是在<span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-7346-Frame" tabindex="0" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mi>R</mi><mi>e</mi><mi>g</mi><mi>u</mi><mi>l</mi><mi>a</mi><mi>r</mi><mi>i</mi><mi>z</mi><mi>e</mi><mi>d</mi><mi>M</mi><mi>F</mi></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-30" style="width: 8.953em; display: inline-block;"><span style="display: inline-block; position: relative; width: 7.153em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.453em, 1007.15em, 2.652em, -999.998em); top: -2.298em; left: 0em;"><span class="mrow" id="MathJax-Span-31"><span class="mi" id="MathJax-Span-32" style="font-family: MathJax_Math-italic;">R</span><span class="mi" id="MathJax-Span-33" style="font-family: MathJax_Math-italic;">e</span><span class="mi" id="MathJax-Span-34" style="font-family: MathJax_Math-italic;">g<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-35" style="font-family: MathJax_Math-italic;">u</span><span class="mi" id="MathJax-Span-36" style="font-family: MathJax_Math-italic;">l</span><span class="mi" id="MathJax-Span-37" style="font-family: MathJax_Math-italic;">a</span><span class="mi" id="MathJax-Span-38" style="font-family: MathJax_Math-italic;">r</span><span class="mi" id="MathJax-Span-39" style="font-family: MathJax_Math-italic;">i</span><span class="mi" id="MathJax-Span-40" style="font-family: MathJax_Math-italic;">z<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-41" style="font-family: MathJax_Math-italic;">e</span><span class="mi" id="MathJax-Span-42" style="font-family: MathJax_Math-italic;">d<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.003em;"></span></span><span class="mi" id="MathJax-Span-43" style="font-family: MathJax_Math-italic;">M<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span><span class="mi" id="MathJax-Span-44" style="font-family: MathJax_Math-italic;">F<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.302em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.309em; border-left: 0px solid; width: 0px; height: 1.253em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>R</mi><mi>e</mi><mi>g</mi><mi>u</mi><mi>l</mi><mi>a</mi><mi>r</mi><mi>i</mi><mi>z</mi><mi>e</mi><mi>d</mi><mi>M</mi><mi>F</mi></math></span></span><script type="math/tex" id="MathJax-Element-7346">Regularized MF</script>的基础上,引入概率模型进一步优化。假设用户<span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-7347-Frame" tabindex="0" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mi>U</mi></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-45" style="width: 1.002em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0.802em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.453em, 1000.8em, 2.452em, -999.998em); top: -2.298em; left: 0em;"><span class="mrow" id="MathJax-Span-46"><span class="mi" id="MathJax-Span-47" style="font-family: MathJax_Math-italic;">U<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.302em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.059em; border-left: 0px solid; width: 0px; height: 1.003em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math></span></span><script type="math/tex" id="MathJax-Element-7347">U</script>和项目<span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-7348-Frame" tabindex="0" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mi>V</mi></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-48" style="width: 1.002em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0.802em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.453em, 1000.8em, 2.452em, -999.998em); top: -2.298em; left: 0em;"><span class="mrow" id="MathJax-Span-49"><span class="mi" id="MathJax-Span-50" style="font-family: MathJax_Math-italic;">V<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.202em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.302em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.059em; border-left: 0px solid; width: 0px; height: 1.003em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>V</mi></math></span></span><script type="math/tex" id="MathJax-Element-7348">V</script>的特征矩阵均服从高斯分布,通过评分矩阵已知值得到<span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-7349-Frame" tabindex="0" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mi>U</mi></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-51" style="width: 1.002em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0.802em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.453em, 1000.8em, 2.452em, -999.998em); top: -2.298em; left: 0em;"><span class="mrow" id="MathJax-Span-52"><span class="mi" id="MathJax-Span-53" style="font-family: MathJax_Math-italic;">U<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.102em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.302em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.059em; border-left: 0px solid; width: 0px; height: 1.003em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>U</mi></math></span></span><script type="math/tex" id="MathJax-Element-7349">U</script>和<span class="MathJax_Preview" style="color: inherit; display: none;"></span><span class="MathJax" id="MathJax-Element-7350-Frame" tabindex="0" data-mathml="<math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;><mi>V</mi></math>" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-54" style="width: 1.002em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0.802em; height: 0px; font-size: 125%;"><span style="position: absolute; clip: rect(1.453em, 1000.8em, 2.452em, -999.998em); top: -2.298em; left: 0em;"><span class="mrow" id="MathJax-Span-55"><span class="mi" id="MathJax-Span-56" style="font-family: MathJax_Math-italic;">V<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.202em;"></span></span></span><span style="display: inline-block; width: 0px; height: 2.302em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.059em; border-left: 0px solid; width: 0px; height: 1.003em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>V</mi></math></span></span><script type="math/tex" id="MathJax-Element-7350">V</script>的特征矩阵,然后用特征矩阵去预测评分矩阵中的未知值。</strong></p>

若用户UU

同理:项目V的特征矩阵满足如下等式:
p(V|σ2V)=Ni=1N(Vi|0,σ2VI)p(V|σV2)=∏i=1NN(Vi|0,σV2I)

其中N(x|u,σ2)N(x|u,σ2)的高斯分布。


假设真实值RR那么:

那么评分矩阵RR的条件概率如下:

P(R|U,V,σ2)=Ni=1Mj=1[N(Rij|UTiVj,σ2)]IijP(R|U,V,σ2)=∏i=1N∏j=1M[N(Rij|UiTVj,σ2)]Iij

这里UU的联合分布:

P(U,V|R,σ2,σ2U,σ2V)=P(R|U,V,σ2)P(U|σ2U)P(V|σ2V)P(U,V|R,σ2,σU2,σV2)=P(R|U,V,σ2)P(U|σU2)P(V|σV2)


为什么要转换为这种形式呢?这还要从极大似然估计MLEMLE)说起。

最大似然估计:假设观察数据满足FF,那么样本的概率表示为:

P(x1,x2,,xn)=fD(x1,x2,xn|θ)P(x1,x2,…,xn)=fD(x1,x2,…,xn|θ)

仔细想想,当前样本数据已知,未知参数只有θθ一元函数的最优值的方式。

求极大似然估计(MLE)的一般步骤是:

  1. 由总体分布导出样本的联合概率函数 (或联合密度);

  2. 把样本联合概率函数(或联合密度)中自变量看成已知常数,而把参数 看作自变量,得到似然函数L(θθ的MLE;

  3. 在最大值点的表达式中, 用样本值代入就得参数的极大似然估计值 .

似然函数:
这里写图片描述

通常取对数(对数似然),以便将乘化为加:

这里写图片描述

这样,待估计参数就可以表示为如下形式:

这里写图片描述

同理若待估计参数有两个,比如样本服从高斯分布,如下式,可以通过求偏导数得到估计值。

这里写图片描述

这样,PMF为何要转换为RUVR,U,V里的已知值计算出来(评估),然后为何会转为等式右边,这得需要最大后验概率的知识。

最大后验概率:

最大后验估计,融入了要估计量的先验分布在其中,也就是说待估计量θ本身也满足某概率分布g(θ)(已知), 称为先验分布。这样根据贝叶斯理论,似然函数有如下表示:(这里f(θ|x)等价l(θ|x)是似然函数,表示已知样本数据x集合,来评估θ的值(条件概率),但后面的等式就只关乎密度函数f了)。

这里写图片描述

贝叶斯公式大家都懂,这里我就说说分母为啥写成这个形式。此f是关于和θ和x的联合分布密度,不是我么理解的事件ABC,同时发生等。正常来说分母应该是f(x),表示只考虑x这一影响因素,要消除θ的影响,那么我么是通过对θ积分来消除θ,分母的结果最终是等于f(x)的,分子是等于f(θ,x)的。最终,待估参数表达为:

这里写图片描述

分母的积分结果得到关于f(x)的密度函数,已知的对不。这样,最大后验概率的待估参数就是在最大似然估计的结果后面多乘了个待估参数的先验分布。写到这,大家就该懂了为啥等式右边是那种形式了,在最大似然估计的基础上要添加UVU和V本身的先验分布。

RUVR,U,V的联合密度对数化:

这里写图片描述

最大化后验概率U和V(最大可能性),等价于求下式的最小值:
这里写图片描述
其中:
这里写图片描述

解传统矩阵分解可以采用各种优化方法,对于概率分解,由于最后求的是参数U和V的最大似然估计,因此可以用最大期望法(EM)和马尔可夫链蒙特卡罗算法(MCMC)。这里就不多说了。

PMF也有改进的地方,它没有考虑到评分过程中用户的个人信息,比如有的用户就是喜欢打低分,有的项目(电影)质量就是不高,分肯定高不了等,这样可以采用加入偏置的概率矩阵分解(贝叶斯概率矩阵分解BPMF),将在后面的博客中写出,会给出链接。

补充:联合分布f(x,y),其中x和y无必然联系,x可以理解为老师课讲得好,y理解为课开在周六,那么f表示这节课选课的人数的概率密度,联合分布的概率跟f(x)一样,也是通过积分来求,f(x)求面积,而f(x,y)是求体积。

最大似然估计和最大后验概率是参考了这两篇篇博客:

http://blog.csdn.net/upon_the_yun/article/details/8915283
http://wiki.mbalib.com/wiki/%E6%9C%80%E5%A4%A7%E4%BC%BC%E7%84%B6%E4%BC%B0%E8%AE%A1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值