GithubHelp home page GithubHelp logo

nlp-robustness-evaluation's Introduction

Robustness Evaluation for NLP

Download Data

Run sh data/download_data.sh to download the data needed for the experiments. This will download the preprocessed IMDB dataset, the word embeddings for the neural network and for the adversarial attack, and dictionaries of cached nearest neighbors.

Download StanfordCoreNLP

Run sh download_stanfordcorenlp.sh to download the Standford CoreNLP parser.

Train LSTM model

Run python train_lstm_model.py to train an LSTM model for sentiment classification on the IMDB dataset.

Perform verification using DeepGo

Run python verification.py to perform robustness analysis using DeepGo on the LSTM.

Obtain explanations for sentiment analysis.

Run the code in sbe_examples.ipynb to generate explanations for sentiment analysis, using the adaptation of Spectrum-Based Explanations to text classification.

Generate adversarial examples

Run the code in attack.ipynb to generate adversarial examples for sentiment analysis. To visualize the generated adversarial examples run the code in visualize_attack.ipynb. Some examples of adversarial examples are already shown in visualize_attack.ipynb.

Fix the classification

Run the code in fix_classification.ipynb to generate suggestions that change the classification of a text to the correct class. To visualize the suggestions run the code in visualize_fixing.ipynb.

nlp-robustness-evaluation's People

Contributors

antonis19 avatar

Stargazers

Kala avatar

Watchers

 avatar paper2code - bot 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.