chilynn / sequence-labeling

307 stars 167 forks source link

请教下,实现CRF的这部分代码的过程中参考了哪些文献或博客 #8

Open sunbohit opened 7 years ago

sunbohit commented 7 years ago

有很多行代码实在是看不懂……

sunbohit commented 7 years ago

比如“targets_weight”在模型里是起到什么作用的?

chilynn commented 7 years ago

1、抱歉,当时没有写太多注释,主要参考的https://github.com/glample/tagger ,但是他这个是基于theano实现的,而且是sgd,不是mini-batch,基于它的思路改成tensorflow的mini-batch版本 2、targets_weight主要是考虑到在损失函数中,不同label的权重应该不一样的,错误预测BE的代价应该比M的代价大,M的代价比O的代价要大,使模型更加关注边界的performance。但是在bilstm+crf中,targets_weight这个变量最后没用上,因为加了一层crf,而不是简单的交叉熵,这个targets_weight暂时加不进去,所以这个变量可以暂时忽略