/adversarial_training

Pytorch implementation of the methods proposed in **Adversarial Training Methods for Semi-Supervised Text Classification** on IMDB dataset

Primary LanguagePython

Adversarial Training

Pytorch implementation of Adversarial Training Methods for Semi-Supervised Text Classification (sentiment analysis on IMDB dataset, only adversarial training done).

Based on

  1. Paper Adversarial training methods for semi-supervised text classification, ICLR 2017, Miyato T., Dai A., Goodfellow I. Only adversarial training has been implemented.
  2. Github repository Adversarial Training Methods. This is another implementation using tensorflow.

Requirements

This repository has been tested under python 3.6 and Pytorch 0.4.1 with GPU.

Usage

  1. Download preprocessed IMDB dataset for this repository (you can also find the URL in imdb/google_drive.txt). And then uncompressing these files into directory imdb. Of course, you can try to generate these files under the guidance of Adversarial Training Methods.
  2. Run the main function in at_pytorch/run.py:
$ cd ./at_pytorch
$ python3 run.py

Results

The running result can be seen in file at_pytorch/standard_result.txt, and brief description is as following:

Method Seq. Length Epochs Accuracy
baseline 400 10 0.854
adversarial 400 10 0.871

We have not got the results reported by the original paper, but our result shows the effectiveness of adversarial training.