Giter VIP home page Giter VIP logo

conwea's Introduction

ConWea: Contextualized Weak Supervision for Text Classification

Model

CONWEA-Framework

Training

Required inputs

Each Dataset should contain following files:

  • DataFrame pickle file
    • Example: data/nyt/coarse/df.pkl
      • This dataset should contain two columns named sentence, label
      • sentence contains text and label contains its corresponding label.
      • Must be named as df.pkl
  • Seed Words Json file
    • Example: data/nyt/coarse/seedwords.json
      • This json file contains seed words list for each label.
      • Must be named as seedwords.json

Commands

Corpus Contextualization:

The contextualize.py requires three arguments: dataset_path, which is a path to dataset containing required DataFrame and seedwords, temp_dir is a path to a temporary directory which is used for dumping intermediate files during contextualizing the corpus, and gpu_id refers to the id of the gpu. If not mentioned, the process runs on cpu. To contextualize the corpus, please run:

$ python contextualize.py --dataset_path dataset_path --temp_dir temp_dir_path --gpu_id 3

The tests/test_contextualize.py is a unittest to check the sanity of contextualization. To run this unittest, please execute:

$ python -m unittest tests/test_contextualize.py

ConWea - Iterative Framework:

The train.py requires two arguments: dataset_path, which is a path to dataset containing required contextualized corpus DataFrame dumped by contextualize.py and seed words, and gpu_id refers to the id of the gpu. If not mentioned, the process runs on cpu. To train ConWea, please run:

$ python train.py --dataset_path dataset_path --gpu_id 3

The tests/test_conwea.py is a unittest to check the sanity of framework. To run this unittest, please execute:

$ python -m unittest tests/test_conwea.py

Requirements

This project is based on python==3.7. The dependencies are as follow:

keras-contrib==2.0.8
scikit-learn==0.21.3
flair==0.4.4
scipy=1.3.1
gensim==3.8.1
numpy==1.17.2

Citation

@inproceedings{mekala-shang-2020-contextualized,
    title = "Contextualized Weak Supervision for Text Classification",
    author = "Mekala, Dheeraj  and
      Shang, Jingbo",
    booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
    month = jul,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2020.acl-main.30",
    pages = "323--333",
    abstract = "Weakly supervised text classification based on a few user-provided seed words has recently attracted much attention from researchers. Existing methods mainly generate pseudo-labels in a context-free manner (e.g., string matching), therefore, the ambiguous, context-dependent nature of human language has been long overlooked. In this paper, we propose a novel framework ConWea, providing contextualized weak supervision for text classification. Specifically, we leverage contextualized representations of word occurrences and seed word information to automatically differentiate multiple interpretations of the same word, and thus create a contextualized corpus. This contextualized corpus is further utilized to train the classifier and expand seed words in an iterative manner. This process not only adds new contextualized, highly label-indicative keywords but also disambiguates initial seed words, making our weak supervision fully contextualized. Extensive experiments and case studies on real-world datasets demonstrate the necessity and significant advantages of using contextualized weak supervision, especially when the class labels are fine-grained.",
}

conwea's People

Contributors

dheeraj7596 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.