Giter Club home page Giter Club logo

lstm_crf_useagac's Introduction

LSTM-CRF in PyTorch

数据介绍

数据准备

git clone https://github.com/ouyangsizhuo/LSTM_CRF_useAGAC.git

实验所需的所有文件都在这个文件夹中

数据来源:AGAC 解压AGAC_train和AGAC_answer这两个压缩包 将数据转换为BIO格式

python3 json2bio.py

注意:运行时需要修改84-87行 得到的数据格式为

token tag
token tag
...

包含两列,第一列是单词,第二列是其对应的标签

输入文件格式要求:

token/tag token/tag token/tag ...
token/tag token/tag token/tag ...
...

分别将train,valid和test数据集转换成这样的输入格式,转换后的数据存放在prepare_data文件夹中,并命名为train.txt,valid.txt,test.txt。数据准备完毕。

模型训练

①、参数设置:(修改下列文件中对应行的代码)

parameters.py:(第13行)

EMBED = {"lookup": 300}

predict.py:(第16行)

load_checkpoint('model.epoch20', model)

train.py:(第34行)

num_epochs = 20

②、训练过程

python3 train.py

这一步会得到训练好的模型并打印出模型结构

python3 predict.py

用训练好的模型进行预测,得到结果文件test_out.tab

对结果进行评估

perl conlleval.pl –d $'\t' <test_out.tab | tee test_out_lstm.eval

lstm_crf_useagac's People

Contributors

yaoxinzhi avatar ouyangsizhuo avatar

Watchers

James Cloos 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.