Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Implementation of Very Deep Convolutional Neural Network for Text Classification

NotificationsYou must be signed in to change notification settings

cjiang2/VDCNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tensorflow Implementation of Very Deep Convolutional Neural Network for Text Classification, proposed byConneau et al.

Archiecture for VDCNN is nowcorrectly re-implemented with Tensorflow 2 and tf.keras support. A simple training interface is implemented followingTensorflow 2 Expert Tutorial. Feel free to contribute additional utilities like TensorBoard support.

Side Note, if you are a newcomer for NLP text classification:

  • Please checkout new SOTA NLP methods liketransformers orBert.

  • Check outPyTorch forMUCH BETTER dynamic graphing and dataset object support.

    • Current VDCNN implementation is also extremely easy to be ported onto PyTorch.

Prerequisites

  • Python3
  • Tensorflow >= 2.0
  • tensorflow-datasets
  • numpy

Datasets

The original paper tests several NLP datasets, including DBPedia, AG's News, Sogou News and etc.

tensorflow-datasets is used to support AG's News dataset.

Downloads of those NLP text classification datasets can be found here (Many thanks to ArdalanM):

DatasetClassesTrain samplesTest samplessource
AG’s News4120 0007 600link
Sogou News5450 00060 000link
DBPedia14560 00070 000link
Yelp Review Polarity2560 00038 000link
Yelp Review Full5650 00050 000link
Yahoo! Answers101 400 00060 000link
Amazon Review Full53 000 000650 000link
Amazon Review Polarity23 600 000400 000link

Parameters Setting

The original paper suggests the following details for training:

  • SGD optimizer with lr 1e-2, decay 0.9.
  • 10 - 15 epochs for convergence.
  • He Initialization.

Some additional parameter settings for this repo:

  • Gradient clipping with norm_value of 7.0, to stablize the training.

Skip connections and pooling are correctly implemented now:

  • k-maxpooling.
  • maxpooling with kernel size of 3 and strides 2.
  • conv pooling with K_i convolutional layer.

For dotted skip connections:

  • Identity with zero padding.
  • Conv1D with kernel size of 1.

Please refer to Conneau et al for their methodology and experiment section in more detail.

Experiments

Results are reported as follows: (i) / (ii)

  • (i): Test set accuracy reported by the paper (acc = 100% - error_rate)
  • (ii): Test set accuracy reproduced by this Keras implementation

TODO: Feel free to report your own experimental results in the following format:

Results for "Identity" Shortcut, "k-max" Pooling:

Depthag_newsDBPediaSogou News
9 layers90.17 / xx.xxxx98.44 / xx.xxxx96.42 / xx.xxxx
17 layers90.61 / xx.xxxx98.39 / xx.xxxx96.49 / xx.xxxx
29 layers91.33 / xx.xxxx98.59 / xx.xxxx96.82 / xx.xxxx
49 layersxx.xx / xx.xxxxxx.xx / xx.xxxxxx.xx / xx.xxxx

Reference

Original preprocessing codes and VDCNN Implementation By geduo15

Train Script and data iterator from Convolutional Neural Network for Text Classification

NLP Datasets Gathered by ArdalanM and Others

About

Implementation of Very Deep Convolutional Neural Network for Text Classification

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp