• Stars
    star
    740
  • Rank 60,843 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implementation of papers for text classification task on DBpedia

Text-Classification

Implement some state-of-the-art text classification models with TensorFlow.

Requirement

  • Python3
  • TensorFlow >= 1.4

Note: Original code is written in TensorFlow 1.4, while the VocabularyProcessor is depreciated, updated code changes to use tf.keras.preprocessing.text to do preprocessing. The new preprocessing function is named data_preprocessing_v2

Dataset

You can load the data with

dbpedia = tf.contrib.learn.datasets.load_dataset('dbpedia', test_with_fake_data=FLAGS.test_with_fake_data)

Or download it from Baidu Yun.

Attention is All Your Need

Paper: Attention Is All You Need

See multi_head.py

Use self-attention where Query = Key = Value = sentence after word embedding

Multihead Attention module is implemented by Kyubyong

IndRNN for Text Classification

Paper: Independently Recurrent Neural Network (IndRNN): Building A Longer and Deeper RNN

IndRNNCell is implemented by batzener

Attention-Based Bidirection LSTM for Text Classification

Paper: Attention-Based Bidirectional Long Short-Term Memory Networks for Relation Classification

See attn_bi_lstm.py

Hierarchical Attention Networks for Text Classification

Paper: Hierarchical Attention Networks for Document Classification

See attn_lstm_hierarchical.py

Attention module is implemented by ilivans/tf-rnn-attention .

Adversarial Training Methods For Supervised Text Classification

Paper: Adversarial Training Methods For Semi-Supervised Text Classification

See: adversrial_abblstm.py

Convolutional Neural Networks for Sentence Classification

Paper: Convolutional Neural Networks for Sentence Classification

See: cnn.py

RMDL: Random Multimodel Deep Learning for Classification

Paper: RMDL: Random Multimodel Deep Learning for Classification

See: RMDL.py See: RMDL Github

Note: The parameters are not fine-tuned, you can modify the kernel as you want.

Performance

Model Test Accuracy Notes
Attention-based Bi-LSTM 98.23 %
HAN 89.15% 1080Ti 10 epochs 12 min
Adversarial Attention-based Bi-LSTM 98.5% AWS p2 2 hours
IndRNN 98.39% 1080Ti 10 epochs 10 min
Attention is All Your Need 97.81% 1080Ti 15 epochs 8 min
RMDL 98.91% 2X Tesla Xp (3 RDLs)
CNN 98.37%

Welcome To Contribute

If you have any models implemented with great performance, you're welcome to contribute. Also, I'm glad to help if you have any problems with the project, feel free to raise a issue.

More Repositories

1

Chinese-Hip-pop-Generation

Generate Chinese hip-pop lyrics using GAN
Python
124
star
2

Awesome-Efficient-PLM

Must-read papers on improving efficiency for pre-trained language models.
96
star
3

MTA-LSTM-TensorFlow

TensorFlow reimplementation of Topic-to-Essay Generation with Neural Networks.
Python
67
star
4

SeqGAN_Poem

Generate Chinese Poem using SeqGAN
Python
36
star
5

XDU-GradeInquiry

Python爬虫登陆教务系统查询成绩,附带均分计算和 GPA 计算,可自定义过滤科目
Python
13
star
6

VEC

Visual and Embodied Concepts evaluation benchmark
12
star
7

ChineseNER

CLUENER2020 Chinese NER task
Python
11
star
8

CCPM-baseline

Python
9
star
9

FilterPlayer

FilterPlayer, using mediaplayer and GLSurfaceView to add filter on videos.
Java
9
star
10

tobiaslee.github.io

TobiasLee's Blog, recording NLP notes and my life.
HTML
6
star
11

FormBERT

Code implementation of FormBERT, accepted by Findings of EMNLP 2021
Python
6
star
12

DeftEval2020

DeftEval 2020: Definition extraction Challenge
Python
5
star
13

ParamCorruption

Reimplementation of AAAI21: Parameter Corruption
Python
4
star
14

Draw-Language-Interpreter

Project of Compile Principle Course in XDU, an interpreter for a simple draw language
Java
4
star
15

Offiziersmesser

Jupyter Notebook
4
star
16

MachineLearningNotes

记录阅读西瓜书《机器学习》的笔记
3
star
17

ReinforcementLearningPractice

Demos when learning RL to help understand better
Python
2
star
18

CoolWeather

Java
1
star
19

BookCheckAppDemo

It's a small app for checking books
Java
1
star
20

android-HeartStone-CardEmulator

炉石开包模拟器
Java
1
star
21

MachineLearningStanford

Machine Learning course of Stanford.
MATLAB
1
star