Git Product home page Git Product logo

adversarial_training_methods's Introduction

Adversarial Training Methods

Adversarial and virtual adversarial training methods for semi-supervised text classification.

Based on the paper: Adversarial training methods for semi-supervised text classification, ICLR 2017, Miyato T., Dai A., Goodfellow I.

Without the pre-training phase

Requirements

Package Version
Python 3.5.4
Jupyter 1.0.0
Tensorflow r1.5
GloVe 1.2
NLTK 3.2.5
ProgressBar2 3.34.3
Matplotlib 2.1.2
Argparse 1.1

Dataset creation

Download the IMDB dataset.

Then we have to do the following steps:

  • prepare dataset in order to train GloVe using glove_training_preparation.ipynb
  • set the vectors length at 256 and remove words appearing in less than 3 reviews in the GloVe training script
  • run GloVe training script
  • create the embedding matrix (used by the network) and the dictionary (used to convert reviews in sequences of index) using pretrained_glove_embedding_script.ipynb
  • convert reviews in sequences of index using dataset_script.pynb and test_dataset_script.ipynb

Training

5% of the training set is used for validation

use paper_network.ipynb or pyramidal_network.ipynb according to the network architecture you want to use.

Paper model Pyramidal model
alt text alt text

Results

Sequences are truncated at 1200 (pyramidal model), 600 and 400 to test the sensitivity of the model to reviews lengths. In particular we cut off or add zero-padding at the initial part of the review.

Method Seq. Length Epochs Accuracy
baseline 400 10 0.906
adversarial 400 10 0.914
virtual adv. 400 10 0.921
baseline 600 10 0.904
adversarial 600 10 0.912
pyramidal baseline 1200 10 0.910
pyramidal adversarial 1200 10 0.916

adversarial_training_methods's People

Contributors

enricivi avatar aurelpjetri avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.