当前位置: 首页 > news >正文

最大熵模型

最大熵模型(maximum entropy model)由最大熵原理推导实现

最大熵原理

最大熵原理是概率模型学习的一个准则。最大熵原理认为,学习概率模型时,在所有可能的概率模型(分布)中,熵最大的模型时最好的模型。通常用约束条件来确定概率模型的集合,所以,最大熵原理也可以表述为在满足约束条件的模型集合中选取熵最大的模型。

假设离散随机变量 X X X的概率分布时 P ( X ) P\left(X\right) P(X),则其熵是
H ( P ) = − ∑ x P ( x ) log ⁡ P ( x ) H\left(P\right) = -\sum_{x}P\left(x\right)\log P\left(x\right) H(P)=xP(x)logP(x)
熵满足下列不等式:
0 ≤ H ( P ) ≤ log ⁡ ∣ X ∣ 0\le H\left(P\right) \le \log \left|X\right| 0H(P)logX
其中 ∣ X ∣ \left|X\right| X X X X的取值个数,当且仅当 X X X的分布是均匀分布时,右边的等号成立。
这就是说,当 X X X服从均匀分布时,熵最大

证明:

max ⁡ p i − ∑ i = 1 n p i log ⁡ p i s.t.  ∑ i = 1 n p i = 1 \begin{aligned} &\max _{p_{i}}-\sum_{i=1}^{n} p_{i} \log p_{i} \\ &\text { s.t. } \sum_{i=1}^{n} p_{i}=1 \end{aligned} pimaxi=1npilogpi s.t. i=1npi=1
显然 − ∑ i = 1 n p i log ⁡ p i ≥ 0 -\sum_{i=1}^{n} p_{i} \log p_{i} \ge 0 i=1npilogpi0
p i p_i pi中其中一个为 1 1 1,其他为 0 0 0时, − ∑ i = 1 n p i log ⁡ p i = 0 -\sum_{i=1}^{n} p_{i} \log p_{i} = 0 i=1npilogpi=0

拉格朗日函数
L ( P , λ ) = − ∑ i = 1 n p i log ⁡ p i − λ ( ∑ i = 1 n p i − 1 ) L\left(P, \lambda\right) = -\sum_{i=1}^{n} p_{i} \log p_{i} - \lambda\left(\sum_{i=1}^{n} p_{i} - 1\right) L(P,λ)=i=1npilogpiλ(i=1npi1)
求导
∂ L ∂ p i = − log ⁡ p i − 1 − λ = 0 \frac{\partial L}{\partial p_i} = -\log p_i - 1-\lambda =0 piL=logpi1λ=0
于是
log ⁡ p 1 = log ⁡ p 2 = ⋯ = log ⁡ p n = − λ − 1 \log p_1=\log p_2 = \cdots = \log p_n = -\lambda - 1 logp1=logp2==logpn=λ1
进而
p 1 = p 2 = ⋯ = p n p_1 = p_2=\cdots = p_n p1=p2==pn

最大熵模型的定义

最大熵原理时统计学习的一般原理,将它应用到分类得到最大熵模型

假设分类模型时一个条件概率分布 P ( Y ∣ X ) P\left(Y|X\right) P(YX) X ∈ X ⊆ R n X\in\mathcal{X}\subseteq \mathbb{R}^n XXRn表示输入, Y ∈ Y Y\in\mathcal{Y} YY表示输出, X \mathcal{X} X Y \mathcal{Y} Y分别是输入和输出的集合。
这个模型表示的是对于给定的输入 X X X,以条件概率 P ( Y ∣ X ) P\left(Y|X\right) P(YX)输出 Y Y Y

给定一个训练数据集
T = { ( x 1 , y 1 ) , ⋯ , ( x N , y N ) } T = \left\{\left(\mathbf{x}_1,y_1\right),\cdots,\left(\mathbf{x}_N,y_N\right)\right\} T={(x1,y1),,(xN,yN)}
学习的目标是用最大熵原理选择最好的分类模型

首先考虑模型应该满足的条件。给定训练数据集,可以确定联合分布 P ( X , Y ) P\left(X,Y\right) P(X,Y)的经验分布和边缘分布 P ( X ) P\left(X\right) P(X)的经验分布,分别以 P ~ ( X , Y ) \tilde{P}\left(X,Y\right) P~(X,Y) P ~ ( X ) \tilde{P}\left(X\right) P~(X)表示。这里
P ~ ( X = x , Y = y ) = v ( X = x , Y = y ) N P ~ ( X = x ) = v ( X = x ) N \tilde{P}\left(X=\mathbf{x},Y=y\right)=\frac{v\left(X=\mathbf{x},Y=y\right)}{N}\\ \tilde{P}\left(X=\mathbf{x}\right) = \frac{v\left(X = \mathbf{x}\right)}{N} P~(X=x,Y=y)=Nv(X=x,Y=y)P~(X=x)=Nv(X=x)
其中, v ( X = x , Y = y ) v\left(X=\mathbf{x},Y= y\right) v(X=x,Y=y)表示训练数据中样本 ( x , y ) \left(\mathbf{x},y\right) (x,y)出现的频率, v ( X = x ) v\left(X=\mathbf{x}\right) v(X=x)表示训练数据中输入 x \mathbf{x} x出现的频率, N N N表示训练样本容量

用特征函数(feature function) f ( x , y ) f\left(\mathbf{x}, y\right) f(x,y)描述输入 x \mathbf{x} x和输出 y y y之间的某一个事实,其定义是
f ( x , y ) = { 1 , x 与 y 满足某一事实 0 , 否则 f\left(\mathbf{x},y\right) = \begin{cases} 1, & \mathbf{x}与y满足某一事实\\ 0, &否则 \end{cases} f(x,y)={1,0,xy满足某一事实否则

特征函数 f ( x , y ) f\left(x,y\right) f(x,y)关于经验分布 P ~ ( X , Y ) \tilde{P}\left(X,Y\right) P~(X,Y)的期望值,用 E P ~ ( f ) E_{\tilde{P}}\left(f\right) EP~(f)表示
E P ~ ( f ) = ∑ x , y P ~ ( x , y ) f ( x , y ) E_{\tilde{P}}\left(f\right)=\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)f\left(\mathbf{x},y\right) EP~(f)=x,yP~(x,y)f(x,y)
特征函数 f ( x , y ) f\left(\mathbf{x},y\right) f(x,y)关于模型 P ( Y ∣ X ) P\left(Y|X\right) P(YX)与经验分布 P ~ ( X ) \tilde{P}\left(X\right) P~(X)的期望值,用 E P ( f ) E_P\left(f\right) EP(f)表示

E P ( f ) = ∑ x , y P ~ ( x ) P ( y ∣ x ) f ( x , y ) E_P\left(f\right) = \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P\left(y|\mathbf{x}\right)f\left(\mathbf{x},y\right) EP(f)=x,yP~(x)P(yx)f(x,y)
如果模型能够获取训练数据中的信息,那么就可以假设这两个期望值相等,即
E P ( f ) = E P ~ ( f ) E_P\left(f\right)=E_{\tilde{P}}\left(f\right) EP(f)=EP~(f)
或者
∑ x , y P ~ ( x ) P ( y ∣ x ) f ( x , y ) = ∑ x , y P ~ ( x , y ) f ( x , y ) \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P\left(y|\mathbf{x}\right)f\left(\mathbf{x},y\right)=\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)f\left(\mathbf{x},y\right) x,yP~(x)P(yx)f(x,y)=x,yP~(x,y)f(x,y)
上式作为模型学习的约束条件
假设有 n n n个特征函数 f i ( x , y ) f_i\left(\mathbf{x},y\right) fi(x,y),那么就有 n n n个约束条件

最大熵模型:假设满足所有约束条件的模型集合为
C ≡ { P ∈ P ∣ E p ( f i ) = E P ~ ( f i ) , i = 1 , 2 , ⋯ , n } \mathcal{C}\equiv\left\{P\in\mathcal{P}|E_p\left(f_i\right) = E_{\tilde{P}}\left(f_i\right),\quad i = 1,2,\cdots, n\right\} C{PPEp(fi)=EP~(fi),i=1,2,,n}
定义在条件概率分布 P ( Y ∣ X ) P\left(Y|X\right) P(YX)上的条件熵为
H ( P ) = − ∑ x , y P ~ ( x ) P ( y ∣ x ) log ⁡ P ( y ∣ x ) H\left(P\right) = -\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P\left(y|\mathbf{x}\right)\log P\left(y|\mathbf{x}\right) H(P)=x,yP~(x)P(yx)logP(yx)
则模型集合 C \mathcal{C} C中条件熵 H ( P ) H\left(P\right) H(P)最大的模型称为最大熵模型。
(其中 log ⁡ = ln ⁡ = log ⁡ e \log = \ln = \log_e log=ln=loge

最大熵模型的学习

最大熵模型的学习过程就是求解最大熵模型的过程。最大熵模型的学习可以形式化为约束最大化问题

对于给定的训练数据集 T = { ( x 1 , y 1 ) , ⋯ , ( x N , y N ) } T=\left\{\left(\mathbf{x}_1,y_1\right), \cdots, \left(\mathbf{x}_N, y_N\right)\right\} T={(x1,y1),,(xN,yN)}以及特征函数 f i ( x , y ) f_i\left(\mathbf{x},y\right) fi(x,y),最大熵的学习等价于约束最优化问题:
max ⁡ P ∈ C H ( P ) = − ∑ x , y P ~ ( x ) P ( y ∣ x ) log ⁡ P ( y ∣ x ) s . t . E P ( f i ) = E P ~ ( f i ) , i = 1 , 2 , ⋯ , n ∑ y P ( y ∣ x ) = 1 \begin{aligned} \max_{P\in \mathcal{C}} & H\left(P\right) = -\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P\left(y|\mathbf{x}\right)\log P\left(y|\mathbf{x}\right)\\ s.t.& E_P\left(f_i\right) = E_{\tilde{P}}\left(f_i\right),\quad i = 1,2,\cdots, n\\ &\sum_{y}P\left(y|\mathbf{x}\right) =1 \end{aligned} PCmaxs.t.H(P)=x,yP~(x)P(yx)logP(yx)EP(fi)=EP~(fi),i=1,2,,nyP(yx)=1
改成最小化
min ⁡ P ∈ C − H ( P ) = ∑ x , y P ~ ( x ) P ( y ∣ x ) log ⁡ P ( y ∣ x ) s . t . E P ( f i ) = E P ~ ( f i ) , i = 1 , 2 , ⋯ , n ∑ y P ( y ∣ x ) = 1 \begin{aligned} \min_{P\in \mathcal{C}} & -H\left(P\right) = \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P\left(y|\mathbf{x}\right)\log P\left(y|\mathbf{x}\right)\\ s.t.& E_P\left(f_i\right) = E_{\tilde{P}}\left(f_i\right),\quad i = 1,2,\cdots, n\\ &\sum_{y}P\left(y|\mathbf{x}\right) =1 \end{aligned} PCmins.t.H(P)=x,yP~(x)P(yx)logP(yx)EP(fi)=EP~(fi),i=1,2,,nyP(yx)=1

拉格朗日函数
L ( P , w ) = − H ( P ) + w 0 ( 1 − ∑ y P ( y ∣ x ) ) + ∑ i = 1 n w i ( E P ~ ( f i ) − E P ( f i ) ) = ∑ x , y P ~ ( x ) P ( y ∣ x ) log ⁡ P ( y ∣ x ) + w 0 ( 1 − ∑ y P ( y ∣ x ) ) + ∑ i = 1 n w i ( ∑ x , y P ~ ( x , y ) f ( x , y ) − ∑ x , y P ~ ( x ) P ( y ∣ x ) f ( x , y ) ) \begin{aligned} L\left(P,\mathbf{w}\right) &=-H\left(P\right) + w_0\left(1 - \sum_{y}P\left(y|\mathbf{x}\right)\right)+\sum_{i=1}^{n}w_i\left(E_{\tilde{P}}\left(f_i\right) - E_P\left(f_i\right)\right)\\ &=\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P\left(y|\mathbf{x}\right)\log P\left(y|\mathbf{x}\right)+w_0\left(1 - \sum_{y}P\left(y|\mathbf{x}\right)\right)\\ &\quad +\sum_{i=1}^{n}w_i\left(\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)f\left(\mathbf{x},y\right) - \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P\left(y|\mathbf{x}\right)f\left(\mathbf{x},y\right)\right) \end{aligned} L(P,w)=H(P)+w0(1yP(yx))+i=1nwi(EP~(fi)EP(fi))=x,yP~(x)P(yx)logP(yx)+w0(1yP(yx))+i=1nwi(x,yP~(x,y)f(x,y)x,yP~(x)P(yx)f(x,y))
原始问题
min ⁡ P ∈ C max ⁡ w L ( P , w ) \min_{P\in \mathcal{C}}\max_{\mathbf{w}} L\left(P,\mathbf{w}\right) PCminwmaxL(P,w)
对偶问题
max ⁡ w min ⁡ P ∈ C L ( P , w ) \max_{\mathbf{w}}\min_{P\in \mathcal{C}} L\left(P,\mathbf{w}\right) wmaxPCminL(P,w)

目标函数是凸的,约束条件是等式约束,于是满足广义Slater条件, 所以原始问题与对偶问题等价

ψ ( w ) = min ⁡ P ∈ C L ( P , w ) = L ( P w , w ) \psi\left(\mathbf{w}\right) = \min_{P\in \mathcal{C}} L\left(P,\mathbf{w}\right)=L\left(P_\mathbf{w},\mathbf{w}\right) ψ(w)=PCminL(P,w)=L(Pw,w)
其中
P w = arg ⁡ min ⁡ P ∈ C L ( P , w ) = P w ( y ∣ x ) P_{\mathbf{w}}=\arg\min_{P\in\mathcal{C}} L\left(P,\mathbf{w}\right) = P_{\mathbf{w}}\left(y|\mathbf{x}\right) Pw=argPCminL(P,w)=Pw(yx)

∂ L ∂ P ( y ∣ x ) = ∑ x , y P ~ ( x ) ( log ⁡ P ( y ∣ x ) + 1 ) − ∑ y w 0 − ∑ x , y ( P ~ ( x ) ∑ i = 1 n w i f i ( x , y ) ) = ∑ x , y P ~ ( x ) ( log ⁡ P ( y ∣ x ) + 1 − w 0 − ∑ i = 1 n w i f i ( x , y ) ) = 0 \begin{aligned} \frac{\partial L}{\partial P\left(y|\mathbf{x}\right)} &= \sum_{\mathbf{x},y} \tilde{P}\left(\mathbf{x}\right)\left(\log P\left(y|\mathbf{x}\right) + 1\right)-\sum_{y}w_0-\sum_{\mathbf{x},y}\left(\tilde{P}\left(\mathbf{x}\right)\sum_{i=1}^{n}w_if_i\left(\mathbf{x},y\right)\right)\\ &= \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)\left(\log P\left(y|\mathbf{x}\right) + 1-w_0-\sum_{i=1}^{n}w_if_i\left(\mathbf{x},y\right)\right)\\ &=0 \end{aligned} P(yx)L=x,yP~(x)(logP(yx)+1)yw0x,y(P~(x)i=1nwifi(x,y))=x,yP~(x)(logP(yx)+1w0i=1nwifi(x,y))=0
P ~ ( x ) > 0 \tilde{P}\left(\mathbf{x}\right)>0 P~(x)>0的情况下
P ( y ∣ x ) = e x p ( ∑ i = 1 n w i f i ( x , y ) + w 0 − 1 ) = e x p ( ∑ i = 1 n w i f i ( x , y ) ) e x p ( 1 − w 0 ) P\left(y|\mathbf{x}\right) = exp\left(\sum_{i=1}^{n}w_if_i\left(\mathbf{x},y\right) + w_0 - 1\right)=\frac{exp\left(\sum_{i=1}^{n}w_if_i\left(\mathbf{x},y\right)\right)}{exp\left(1-w_0\right)} P(yx)=exp(i=1nwifi(x,y)+w01)=exp(1w0)exp(i=1nwifi(x,y))

利用 ∑ y P ( y ∣ x ) = 1 \sum_{y} P\left(y|\mathbf{x}\right) = 1 yP(yx)=1,得
P w ( y ∣ x ) = 1 Z w ( x ) e x p ( ∑ i = 1 n w i f i ( x , y ) ) P_{\mathbf{w}}\left(y|\mathbf{x}\right) = \frac{1}{Z_{\mathbf{w}}\left(\mathbf{x}\right)}exp\left(\sum_{i=1}^{n}w_if_i\left(\mathbf{x},y\right)\right) Pw(yx)=Zw(x)1exp(i=1nwifi(x,y))
其中
Z w ( x ) = ∑ y e x p ( ∑ i = 1 n w i f i ( x , y ) ) Z_{\mathbf{w}}\left(\mathbf{x}\right) = \sum_{y}exp\left(\sum_{i=1}^{n}w_if_i\left(\mathbf{x},y\right)\right) Zw(x)=yexp(i=1nwifi(x,y))

其中 Z w ( x ) Z_{\mathbf{w}}\left(\mathbf{x}\right) Zw(x)称为规范化因子;
P w = P w ( y ∣ x ) P_{\mathbf{w}}=P_{\mathbf{w}}\left(y|\mathbf{x}\right) Pw=Pw(yx)就是最大熵模型。这里 w \mathbf{w} w是最大熵模型中的参数向量
之后,求解
max ⁡ ψ ( w ) \max\psi\left(\mathbf{w}\right) maxψ(w)

w ∗ = arg ⁡ max ⁡ w ψ ( w ) \mathbf{w}^{*} = \arg\max_{\mathbf{w}}\psi\left(\mathbf{w}\right) w=argwmaxψ(w)

极大似然估计

下面证明对偶函数的极大化等价于最大熵模型的极大似然估计

训练数据的经验概率分布 P ~ ( X , Y ) \tilde{P}\left(X,Y\right) P~(X,Y),条件概率分布 P ( Y ∣ X ) P\left(Y|X\right) P(YX)的对数似然函数表示为
L P ~ ( P w ) = log ⁡ π x , y P ( y ∣ x ) P ~ ( x , y ) = ∑ x , y P ~ ( x , y ) log ⁡ P ( y ∣ x ) L_{\tilde{P}} \left(P_{\mathbf{w}}\right) = \log \pi_{\mathbf{x},y}P\left(y|\mathbf{x}\right)^{\tilde{P}\left(\mathbf{x},y\right)} =\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right) \log P\left(y|\mathbf{x}\right) LP~(Pw)=logπx,yP(yx)P~(x,y)=x,yP~(x,y)logP(yx)

L P ~ ( P w ) = ∑ x , y P ~ ( x , y ) log ⁡ P ( y ∣ x ) = ∑ x , y P ~ ( x , y ) ∑ i = 1 n w i f i ( x , y ) − ∑ x , y P ~ ( x , y ) log ⁡ Z w ( x ) = ∑ x , y P ~ ( x , y ) ∑ i = 1 n w i f i ( x , y ) − ∑ x P ~ ( x ) log ⁡ Z w ( x ) \begin{aligned} L_{\tilde{P}}\left(P_{\mathbf{w}}\right) &= \sum_{\mathbf{x},y} \tilde{P}\left(\mathbf{x},y\right) \log P\left(y|\mathbf{x}\right)\\ &=\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)\sum_{i=1}^{n}w_i f_i\left(\mathbf{x},y\right) - \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)\log Z_{\mathbf{w}}\left(\mathbf{x}\right)\\ &=\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)\sum_{i=1}^{n}w_i f_i\left(\mathbf{x},y\right) - \sum_{\mathbf{x}}\tilde{P}\left(\mathbf{x}\right)\log Z_{\mathbf{w}}\left(\mathbf{x}\right) \end{aligned} LP~(Pw)=x,yP~(x,y)logP(yx)=x,yP~(x,y)i=1nwifi(x,y)x,yP~(x,y)logZw(x)=x,yP~(x,y)i=1nwifi(x,y)xP~(x)logZw(x)
接着
ψ ( w ) = ∑ x , y P ~ ( x ) P w ( y , x ) log ⁡ P w ( y ∣ x ) + ∑ i = 1 n w i ( ∑ x , y P ~ ( x , y ) f i ( x , y ) − ∑ x , y P ~ ( x ) P w ( y ∣ x ) f i ( x , y ) ) = ∑ x , y P ~ ( x , y ) ∑ i = 1 n w i f i ( x , y ) + ∑ x , y P ~ ( x ) P w ( y ∣ x ) ( log ⁡ P w ( y ∣ x ) − ∑ i = 1 n w i f i ( x , y ) ) = ∑ x , y P ~ ( x , y ) ∑ i = 1 n w i f i ( x , y ) − ∑ x , y P ~ ( x ) P w ( y ∣ x ) log ⁡ Z w ( x ) = ∑ x , y P ~ ( x , y ) ∑ i = 1 n w i f i ( x , y ) − ∑ x , y P ~ ( x ) log ⁡ Z w ( x ) \begin{aligned} \psi\left(\mathbf{w}\right) &= \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P_{\mathbf{w}}\left(y,\mathbf{x}\right)\log P_{\mathbf{w}}\left(y|\mathbf{x}\right) \\ &\quad + \sum_{i=1}^n w_i\left(\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)f_i\left(\mathbf{x},y\right) - \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P_{\mathbf{w}}\left(y|\mathbf{x}\right)f_i\left(\mathbf{x},y\right)\right)\\ &=\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)\sum_{i=1}^{n}w_i f_i\left(\mathbf{x},y\right) + \sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right) P_{\mathbf{w}}\left(y|\mathbf{x}\right)\left(\log P_{\mathbf{w}}\left(y|\mathbf{x}\right) - \sum_{i=1}^{n}w_if_i\left(\mathbf{x},y\right)\right)\\ &=\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)\sum_{i=1}^{n}w_i f_i\left(\mathbf{x},y\right)-\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)P_{\mathbf{w}}\left(y|\mathbf{x}\right)\log Z_{\mathbf{w}}\left(\mathbf{x}\right)\\ &=\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x},y\right)\sum_{i=1}^{n}w_i f_i\left(\mathbf{x},y\right)-\sum_{\mathbf{x},y}\tilde{P}\left(\mathbf{x}\right)\log Z_{\mathbf{w}}\left(\mathbf{x}\right)\\ \end{aligned} ψ(w)=x,yP~(x)Pw(y,x)logPw(yx)+i=1nwi(x,yP~(x,y)fi(x,y)x,yP~(x)Pw(yx)fi(x,y))=x,yP~(x,y)i=1nwifi(x,y)+x,yP~(x)Pw(yx)(logPw(yx)i=1nwifi(x,y))=x,yP~(x,y)i=1nwifi(x,y)x,yP~(x)Pw(yx)logZw(x)=x,yP~(x,y)i=1nwifi(x,y)x,yP~(x)logZw(x)

这样,最大熵模型的学习问题就转化为具体求解对数似然函数极大化或对偶函数极大化的问题

可以将最大熵模型写成更一般的形式
1 Z w ( x ) e x p ( ∑ i = 1 n w i f i ( x , y ) ) \frac{1}{Z_{\mathbf{w}}\left(\mathbf{x}\right)}exp\left(\sum_{i=1}^{n}w_i f_i\left(\mathbf{x},y\right)\right) Zw(x)1exp(i=1nwifi(x,y))
其中
Z w ( x ) = ∑ y e x p ( ∑ i = 1 n w i f i ( x , y ) ) Z_{\mathbf{w}}\left(\mathbf{x}\right)=\sum_{y}exp\left(\sum_{i=1}^{n}w_i f_i\left(\mathbf{x},y\right)\right) Zw(x)=yexp(i=1nwifi(x,y))
这里 x ∈ R n \mathbf{x}\in\mathbb{R}^n xRn为输入, y ∈ { 1 , 2 , ⋯ , K } y\in\left\{1,2,\cdots, K\right\} y{1,2,,K}为输出, w ∈ R n \mathbf{w}\in\mathbb{R}^n wRn为权值向量, f i ( x , y ) f_i\left(\mathbf{x},y\right) fi(x,y)为任意实值特征函数

参考:
统计学习方法(李航)

http://www.lryc.cn/news/69389.html

相关文章:

  • 微服务中网关的配置
  • Linux基本指令实现4及热键指令详解
  • 系统调用与API
  • OpenPCDet系列 | 5.4.1 DenseHead中的AnchorGenerator锚框生成模块
  • 【开发者指南】如何在MyEclipse中使用HTML或JSP设计器?(上)
  • Node开发Web后台服务
  • Linux下对mmap封装使用
  • 深入了解云计算:发展历程、服务与部署模型、未来趋势与挑战
  • 使用乐鑫 Web IDE 助力物联网开发
  • Maven(5)---Maven的部署和发布
  • 内网渗透之权限维持-黄金白银票据隐藏账户远控-RustDeskGotoHTTP
  • 动态规划——带权活动选择
  • 软考A计划-真题-分类精讲汇总-第十八章(面向对象程序设计)
  • 【C++ 入坑指南】(09)数组
  • Vue.js
  • 博士毕业答辩流程 注意事项
  • 拼多多开放平台订单详情接口解析
  • 如何把ipa文件(iOS安装包)安装到iPhone手机上? 附方法汇总
  • 由浅入深了解 深度神经网络优化算法
  • LIN-报文结构
  • 南京邮电大学通达学院2023c++实验报告(三)
  • ISO9000和ISO9001有哪些区别?
  • 第7章异常、断言和曰志
  • springboot读取和写入csv文件数据
  • 【产品经理】工作交接
  • Springer期刊 latex投稿经验分享
  • Python 文件读取的练习
  • Redis:主从复制_通过此功能实现对内存上的数据更好的保护
  • LoRA:大模型的低秩自适应微调模型
  • 拼多多买家如何导出“个人中心”订单信息