All Projects → xuyanfu → Tensorflow_rlre

xuyanfu / Tensorflow_rlre

Reinforcement Learning for Relation Classification from Noisy Data(TensorFlow)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tensorflow rlre

Machin
Reinforcement learning library(framework) designed for PyTorch, implements DQN, DDPG, A2C, PPO, SAC, MADDPG, A3C, APEX, IMPALA ...
Stars: ✭ 145 (-3.33%)
Mutual labels:  reinforcement-learning
Information Extraction Chinese
Chinese Named Entity Recognition with IDCNN/biLSTM+CRF, and Relation Extraction with biGRU+2ATT 中文实体识别与关系提取
Stars: ✭ 1,888 (+1158.67%)
Mutual labels:  relation-extraction
Doudizhu
AI斗地主
Stars: ✭ 149 (-0.67%)
Mutual labels:  reinforcement-learning
Sumo Rl
A simple interface to instantiate Reinforcement Learning environments with SUMO for Traffic Signal Control. Compatible with Gym Env from OpenAI and MultiAgentEnv from RLlib.
Stars: ✭ 145 (-3.33%)
Mutual labels:  reinforcement-learning
Show Adapt And Tell
Code for "Show, Adapt and Tell: Adversarial Training of Cross-domain Image Captioner" in ICCV 2017
Stars: ✭ 146 (-2.67%)
Mutual labels:  reinforcement-learning
Study Reinforcement Learning
Studying Reinforcement Learning Guide
Stars: ✭ 147 (-2%)
Mutual labels:  reinforcement-learning
Data Science Question Answer
A repo for data science related questions and answers
Stars: ✭ 2,000 (+1233.33%)
Mutual labels:  reinforcement-learning
Kg Baseline Pytorch
2019百度的关系抽取比赛,使用Pytorch实现苏神的模型,F1在dev集可达到0.75,联合关系抽取,Joint Relation Extraction.
Stars: ✭ 149 (-0.67%)
Mutual labels:  relation-extraction
Chess Alpha Zero
Chess reinforcement learning by AlphaGo Zero methods.
Stars: ✭ 1,868 (+1145.33%)
Mutual labels:  reinforcement-learning
Hatt Proto
Code and dataset of AAAI2019 paper Hybrid Attention-Based Prototypical Networks for Noisy Few-Shot Relation Classification
Stars: ✭ 149 (-0.67%)
Mutual labels:  relation-extraction
Tensor2tensor
Library of deep learning models and datasets designed to make deep learning more accessible and accelerate ML research.
Stars: ✭ 11,865 (+7810%)
Mutual labels:  reinforcement-learning
Bertem
论文实现(ACL2019):《Matching the Blanks: Distributional Similarity for Relation Learning》
Stars: ✭ 146 (-2.67%)
Mutual labels:  relation-extraction
Open Quadruped
An open-source 3D-printed quadrupedal robot. Intuitive gait generation through 12-DOF Bezier Curves. Full 6-axis body pose manipulation. Custom 3DOF Leg Inverse Kinematics Model accounting for offsets.
Stars: ✭ 148 (-1.33%)
Mutual labels:  reinforcement-learning
Articulations Robot Demo
Stars: ✭ 145 (-3.33%)
Mutual labels:  reinforcement-learning
Energy Py
Reinforcement learning for energy systems
Stars: ✭ 148 (-1.33%)
Mutual labels:  reinforcement-learning
Allenact
An open source framework for research in Embodied-AI from AI2.
Stars: ✭ 144 (-4%)
Mutual labels:  reinforcement-learning
Rainbow
A PyTorch implementation of Rainbow DQN agent
Stars: ✭ 147 (-2%)
Mutual labels:  reinforcement-learning
Open Ie Papers
Open Information Extraction (OpenIE) and Open Relation Extraction (ORE) papers and data.
Stars: ✭ 150 (+0%)
Mutual labels:  relation-extraction
Macadam
Macadam是一个以Tensorflow(Keras)和bert4keras为基础,专注于文本分类、序列标注和关系抽取的自然语言处理工具包。支持RANDOM、WORD2VEC、FASTTEXT、BERT、ALBERT、ROBERTA、NEZHA、XLNET、ELECTRA、GPT-2等EMBEDDING嵌入; 支持FineTune、FastText、TextCNN、CharCNN、BiRNN、RCNN、DCNN、CRNN、DeepMoji、SelfAttention、HAN、Capsule等文本分类算法; 支持CRF、Bi-LSTM-CRF、CNN-LSTM、DGCNN、Bi-LSTM-LAN、Lattice-LSTM-Batch、MRC等序列标注算法。
Stars: ✭ 149 (-0.67%)
Mutual labels:  relation-extraction
Minimalrl
Implementations of basic RL algorithms with minimal lines of codes! (pytorch based)
Stars: ✭ 2,051 (+1267.33%)
Mutual labels:  reinforcement-learning

Reinforcement Learning for Relation Classification from Noisy Data(TensorFlow)

Relation classification from noisy data, aiming to categorize semantic relations between two entities given a plain text with the automantically generated training data.The original [code] of Reinforcement Learning for Relation Classification from Noisy Data is C++. This is a tensorflow implementation.

Evaluation Results

[email protected] comparison between RLCNN and CNN:

Precision/Recall curve of RLCNN and CNN:

Data

We use the same dataset(NYT10) as in [Lin et al.,2016]. And we provide it in origin_data/ directory.

Pre-Trained Word Vectors are learned from New York Times Annotated Corpus (LDC Data LDC2008T19), which should be obtained from [data]. And we provide it also in the origin_data/ directory.

Entity embeddings are randomly initialized. The number of entities in the entity embedding should be the same with the number of entities in train.txt.

To run our code, the dataset should be put in the folder origin_data/ using the following format, containing five files.

  • train.txt: training file, format (fb_mid_e1, fb_mid_e2, e1_name, e2_name, relation, sentence).
  • test.txt: test file, same format as train.txt.
  • relation2id.txt: all relations and corresponding ids, one per line.
  • vec.txt: the pre-train word embedding file.
  • entity_ebd.npy: the entity embedding file.

Codes

The source codes are in the current main directory. cnnmodel.py contains the original CNN model. rlmodel.py contains the RL model needed to be pre-trained . cnnrlmodel.py jointly trains the instance selector and relation classifier.

Requirements

  • Python (>=3.6.1)
  • TensorFlow (=1.6.0)
  • Matplotlib
  • tqdm

Initialize

Before you train your model, you need to type the following command:

python initial.py

The program will transform the original data into .npy files for the input of the models. The .npy files will be saved in data/ directory.

Train

For training the CNN model, you need to type the following command:

python cnnmodel.py

The CNN model file will be saved in folder model/

For training the RL model with the CNN model fixed, you need to type the following command:

python rlmodel.py

The RL model file will be saved in folder rlmodel/. Then the program will use the RL model to select the instance from the original training data and use the selected data to train a CNN model.

For jointly training the CNN and RL model, you need to type the following command:

python cnnrlmodel.py

The jointly trained model will be saved in model/ and rlmodel/.

Test

For testing, you need to type the following command:

python test.py

The [email protected] results will be printed and the PR curve data will be saved in data/. You can type the command:

python plot_pr.py

The program will plot the PR curve.

The models in the model/ and rlmodel/ folders are the best models We have trained. You could use them to select instance from training data and do the test.

Reference

[Lin et al., 2016] Yankai Lin, Shiqi Shen, Zhiyuan Liu, Huanbo Luan, and Maosong Sun. Neural Relation Extraction with Selective Attention over Instances. In Proceedings of ACL.

[Feng et al. 2016] Jun Feng, Minlie Huang, Li Zhao, Yang Yang, and Xiaoyan Zhu. Reinforcement Learning for Relation Classification from Noisy Data. In AAAI2018.

https://github.com/thunlp/TensorFlow-NRE

https://github.com/JuneFeng/RelationClassification-RL

https://medium.com/emergent-future/simple-reinforcement-learning-with-tensorflow-part-1-5-contextual-bandits-bff01d1aad9c

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].