允许在两个数据集上训练 CRF 的 Python 包

机器算法验证 Python 软件 条件随机场 迁移学习
2022-04-07 23:35:05

我正在寻找一个允许在两个数据集上训练条件随机场 (CRF) 的 Python 包。

例如:我有两个数据集,数据集 A 和数据集 B。我想在数据集 A 上训练条件随机场,然后在数据集 B 上训练 CRF。我不想同时在两个数据集上加入 CRF。

我查看了pycrfsuite ,但似乎在训练 CRF 后,它无法在其他数据集上进一步训练trainer.train()重置 CRF 的参数)。

我还没有成功查看 CRF++:如何使用 CRF++ 在两个数据集上训练 CRF?


我已将问题交叉发布在:

我将更新此线程以反映我可能在这些链接之一中收到的任何有趣的答案。

2个回答

您可以使用Wapiti镜像):

Wapiti 是一个非常快速的工具包,用于使用判别模型分割和标记序列。它基于maxent模型、最大熵马尔可夫模型和线性链CRF,提出了各种优化和正则化方法,以提高标准模型的计算复杂度和预测性能。Wapiti 在 MLcomp 网站上连续一年多的序列标记任务排名第一。

Wapiti 由 LIMSI-CNRS 开发,部分资金来自 ANR 项目 CroTaL (ANR-07-MDCO-003) 和 MGA (ANR-07-BLAN-0311-02)。

它是用标准 C99+POSIX 编写的,并且是开源的(BSD 许可证)镜像)。

它允许加载模型文件并再次训练。手册镜子):

-m | --model <file>
              Specify a model file to load and to train again. This allow  you
              either  to  continue  an  interrupted  training or to use an old
              model as a starting point for a new training. Beware that no new
              labels  can be inserted in the model. As the training parameters
              are not saved in the model file, you have to specify them again,
              or  specify new one if, for example, you want to continue train-
              ing with another algorithm or a different penalty.

似乎存在一些用于 wapiti 的 python 包装器,例如 python-wapiti ( mirror )。

您可以使用NeuroNER

  • 它在 TensorFlow 中实现了一个双向 LSTM + CRF 网络
  • 适用于 Linux/Mac/Windows
  • 用 Python 编写
  • 开源
  • 允许使用选项use_pretrained_model = True+在两个数据集上训练 CRFtrain_model = True