Skip to content
to add
Python Makefile
Branch: master
Clone or download
Latest commit f0b8041 Mar 1, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
src refine readme file Nov 17, 2018 dataset info added Mar 1, 2019


step 1: train the original model

  • download training/testing dataset and put it in ./data/train.tsv and ./data/test.tsv, each line should consist of the text and the label, seprated by \t
  • cd src/
  • make train_LSTM (to train LSTM classifier)
  • make train_CNN (to train the word-level CNN classifier)
  • Move the models to targeted directory, e.g. ../model/ and ../model/

step 2: set up word embeddings model

step 3 (optional): set up sentence paraphraser (it will take up very large memory)

step 4: generate adversarial examples

  • In the Makefile, change the input parameter model_path to the above generated models; also, change the input parameter first_label to the first label name (e.g. FAKE for the news data) appeared in the training file. (Otherwise the model doesn't distinguish positive and negative labels)

  • "make attack_cnn" to generate adversarial examples of the wcnn model

  • "make attack_lstm" to generate adversarial examples of the lstm classifier

  • To use joint sentence and word level attacks, do step 3 and run the following

  • make attack_cnn_joint

  • make attack_lstm_joint


You can’t perform that action at this time.