Giter Site home page Giter Site logo

pytorch_ner's Introduction

pytorch_NER

模型

使用one-hot + Bi-LSTM + CRF, word2vec + Bi-LSTM + CRF, Albert-tiny +CRF以及BERT-Base +CRF四种模型训练NER任务并对比在两个训练集上的结果。其中在word2vec + Bi-LSTM + CRF模型中使用线性变换将word2vec中的词的向量进行变换,与one-hot embedding进行拼接作为Bi-LSTM的输入;

数据集

data1: 简历数据集

训练集 总标记 O标记 验证集 标签数
3821 13890 5446(占比39.21%) 463 28

data2: 新闻数据集

训练集 总标记 O标记 验证集 标签数
50658 172601 152505(占比88.36%) 4631 7

结果

data1

模型 F1 Precision Recall
one-hot + Bi-LSTM + CRF 0.911 0.911 0.911
word2vec + BiLSTM + CRF 0.928 0.934 0.923
Albert-tiny + CRF 0.936 0.936 0.936
BERT-base + CRF 0.962 0.958 0.966

data2

模型 F1 Precision Recall
one-hot + Bi-LSTM + CRF 0.856 0.873 0.840
word2vec + BiLSTM + CRF 0.895 0.908 0.882
Albert-tiny + CRF 0.891 0.899 0.882
BERT-base + CRF 0.944 0.942 0.947

评价标准为实体完全匹配时的得分。

run

one-hot + Bi-LSTM + CRF:
python lstm_crf.py --batch-size 64 --lr 0.001 --embedding-size 256 --hidden-size 256 --trainset 训练集 --devset 验证集
word2vec + BiLSTM + CRF:
python lstm_crf_wv.py --batch-size 64 --lr 0.001 --embedding-size 128 --hidden-size 256 --trainset 训练集 --devset 验证集 Albert-tiny + CRF, BERT-base + CRF:
python bert_crf.py --batch-size 64 --hidden-size 256 --trainset 训练集 --devset 验证集

pytorch_ner's People

Contributors

yuand23 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.