首发于Singularity
Natural Language Processing By Chris Manning And Dan jurafsky 第7篇

Natural Language Processing By Chris Manning And Dan jurafsky 第7篇

这一节会开始讲最大熵模型和判别模型,

其实熵就是用来衡量事物的混乱程度,抛硬币时正反两面出现概率相同时这时的熵是最大的。

最大熵模型是convex model,这个模型的最大好处就是convex function是可以找到全局最优点的。

最大熵模型不仅有上面的可以找到全局最优点的好处,而且最大熵模型不会像朴素贝叶斯模型那样多计算特征(double count features),

之前我们看过的maximum entropy models都是联合概率的,那么在maximum entropy models中联合概率和条件概率的关系是什么呢?(So what do these joint models of the

probability of X have to do with the conditional model of the full probability of C given D that we were building beforehand? The answer to this question is that we can think of the C cross D space as a complex X)

条件模型可以被认为是加了约束条件的联合模型

接下来如何对最大熵模型进行平滑处理,就像之前的模型一样,因为模型可能会过拟合,所以需要应用平滑技巧,

总结一下应用平滑技巧的原因在于:

  • 容易过拟合
  • 许多在训练集中出现的特征,在测试集中并不会出现
  • 过多的特征,迭代起来十分耗时,所以我们需要去改变模型的公式,使得特征最优

高斯分布前面的分布并不是很重要,最重要的是 (\lambda_{i} - \mu_{i})^2 这一部分,得到的是lambda与平均值的平方距离,相当于一个惩罚项,对远离平均数的参数进行惩罚, 通常将 \mu 设为0,相当于说特征与分类无关(Which is saying that the feature is irrelevant to the classification, Zero-weight features have no influence on the classification),分母的方差参数是用来控制远离零点的容易程度。(if the variance is very small, the optimization will keep the parameter values clustered close to zero. if the variance is very weak, they'll be allowed to walk farther away), 2\sigma_i^2 越大,正则化越差,

从这个实验中可以明显看出Smoothing的好处,特别是在生词方面,加了平滑技巧后,准确率是明显上升了

还可以对数据进行add-one smooting之类的平滑技巧,但是这样做的缺点就是不容易去制造数据。

编辑于 2018-06-13 13:43