【GitHub项目推荐】文本分类最好的几个深度学习方法 TensorFlow 实践

2018 年 11 月 27 日 专知

【导读】文本分类是NLP中常见的任务,近几年来出现了很多基于深度学习相关的方法。比如TextCNN、Attention-Based Bidirection LSTM、对抗学习、自注意力机制等等。因此,进行文本分类这一简单的任务实践是学习不同深度网络比较好的方式,建议大家收藏和学习。


作者:TobiasLee


Github 链接:

https://github.com/TobiasLee/Text-Classification


Text-Classification (文本分类)

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

Requirement

  • Python3

  • TensorFlow >= 1.4

Dataset

You can load the data with

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

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 To be tested To be done


原文链接:

https://github.com/TobiasLee/Text-Classification


-END-

专 · 知

人工智能领域26个主题知识资料全集获取与加入专知人工智能服务群: 欢迎微信扫一扫加入专知人工智能知识星球群,获取专业知识教程视频资料和与专家交流咨询!


请PC登录www.zhuanzhi.ai或者点击阅读原文,注册登录专知,获取更多AI知识资料!



请加专知小助手微信(扫一扫如下二维码添加),加入专知主题群(请备注主题类型:AI、NLP、CV、 KG等)交流~

 AI 项目技术 & 商务合作:bd@zhuanzhi.ai, 或扫描上面二维码联系!

请关注专知公众号,获取人工智能的专业知识!

点击“阅读原文”,使用专知

登录查看更多
39

相关内容

文本分类(Text Classification)任务是根据给定文档的内容或主题,自动分配预先定义的类别标签。
Transformer文本分类代码
专知会员服务
118+阅读 · 2020年2月3日
【书籍】深度学习框架:PyTorch入门与实践(附代码)
专知会员服务
167+阅读 · 2019年10月28日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
计算机视觉最佳实践、代码示例和相关文档
专知会员服务
20+阅读 · 2019年10月9日
TensorFlow 2.0 学习资源汇总
专知会员服务
67+阅读 · 2019年10月9日
Github 项目推荐 | PyTorch 实现的 GAN 文本生成框架
AI研习社
35+阅读 · 2019年6月10日
Github项目推荐 | PyTorch文本分类教程
AI研习社
7+阅读 · 2019年6月7日
【推荐】TensorFlow手把手CNN实践指南
机器学习研究会
5+阅读 · 2017年8月17日
Arxiv
22+阅读 · 2018年8月30日
Arxiv
4+阅读 · 2018年3月30日
VIP会员
相关VIP内容
Transformer文本分类代码
专知会员服务
118+阅读 · 2020年2月3日
【书籍】深度学习框架:PyTorch入门与实践(附代码)
专知会员服务
167+阅读 · 2019年10月28日
机器学习入门的经验与建议
专知会员服务
94+阅读 · 2019年10月10日
计算机视觉最佳实践、代码示例和相关文档
专知会员服务
20+阅读 · 2019年10月9日
TensorFlow 2.0 学习资源汇总
专知会员服务
67+阅读 · 2019年10月9日
相关资讯
Github 项目推荐 | PyTorch 实现的 GAN 文本生成框架
AI研习社
35+阅读 · 2019年6月10日
Github项目推荐 | PyTorch文本分类教程
AI研习社
7+阅读 · 2019年6月7日
【推荐】TensorFlow手把手CNN实践指南
机器学习研究会
5+阅读 · 2017年8月17日
相关论文
Arxiv
22+阅读 · 2018年8月30日
Arxiv
4+阅读 · 2018年3月30日
Top
微信扫码咨询专知VIP会员