Code Monkey home page Code Monkey logo

adan's Introduction

Language-Adversarial Training for Cross-Lingual Text Classification

This repo contains the source code for our TACL journal paper:

Adversarial Deep Averaging Networks for Cross-Lingual Sentiment Classification
Xilun Chen, Yu Sun, Ben Athiwaratkun, Claire Cardie, Kilian Weinberger
Transactions of the Association for Computational Linguistics (TACL)
paper (arXiv), bibtex (arXiv), paper (TACL), bibtex, talk@EMNLP2018

Introduction

ADAN transfers the knowledge learned from labeled data on a resource-rich source language to low-resource languages where only unlabeled data exists. It achieves cross-lingual model transfer via learning language-invariant features extracted by Language-Adversarial Training.

Requirements

  • Python 3.6
  • PyTorch 0.4
  • PyTorchNet (for confusion matrix)
  • scipy
  • tqdm (for progress bar)

File Structure

.
├── README.md
└── code
    ├── data_prep                       (data processing scripts)
    │   ├── chn_hotel_dataset.py        (processing the Chinese Hotel Review dataset)
    │   └── yelp_dataset.py             (processing the English Yelp Review dataset)
    ├── layers.py                       (lower-level helper modules)
    ├── models.py                       (higher-level modules)
    ├── options.py                      (hyper-parameters aka. all the knobs you may want to turn)
    ├── train.py                        (main file to train the model)
    ├── utils.py                        (helper functions)
    └── vocab.py                        (vocabulary)

Dataset

The datasets can be downloaded separately here.

To support new datasets, simply write a new script under data_prep similar to the current ones and update train.py to correctly load it.

Run Experiments

python train.py --model_save_file {path_to_save_the_model}

By default, the code uses CNN as the feature extractor. To use the LSTM (with dot attention) feature extractor:

python train.py --model lstm --F_layers 2 --model_save_file {path_to_save_the_model}

adan's People

Contributors

ccsasuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

adan's Issues

Question: Are the embeddings updated during training?

Are the embeddings updated or are they frozen? Since you are using multilingual embeddings, seems to me that the model would better adapt the weights of F to different languages if you wouldn't update the embedding space

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.