GithubHelp home page GithubHelp logo

minicongts's Introduction

MiniConGTS

Overview

This repository serves as the official codebase for my recent work, "MiniConGTS: A Near Ultimate Minimalist Contrastive Grid Tagging Scheme for Aspect Sentiment Triplet Extraction". The project implements a minimalist tagging scheme and a novel token-level contrastive learning strategy to enhance aspect sentiment triplet extraction performance. The approach leverages the power of Pretrained Language Models (PLMs), such as BERT, RoBERTa etc. to achieve state-of-the-art results without relying on complex classification head designs or external semantic enhancements.

Arxiv Preprint

image

image

image

image

Key Features

  • Minimalist Grid Tagging Scheme: Uses the fewest classes of labels to simplify the tagging process.
  • Token-level Contrastive Learning: Improves the representation quality of PLMs, enhancing their internal potential.
  • High Performance: Achieves state-of-the-art results in Aspect-Based Sentiment Analysis (ABSA) with minimal reliance on complex architectures.
  • Evaluation on GPT Models: Includes first-time evaluations of the Chain-of-Thought method in context learning scenarios.
  • Comprehensive Analysis: Provides proofs and theoretical analyses to support the efficacy of the proposed methods.

Repository Structure

MiniConGTS/
│
├── data/                   # Directory for datasets
│   ├── D1/
│   │   ├── res14/
│   │   │   ├── train.json
│   │   │   ├── dev.json
│   │   │   └── test.json
│   │   └── ...             # Other datasets
│   └── D2/
│       └── ...
│
├── modules/
│   ├── models/
│   │   ├── roberta.py      # RoBERTa model definition
│   │   └── saved_models/   # Directory for saving trained models
│   └── f_loss.py           # Focal loss implementation
│
├── tools/
│   └── trainer.py          # Training and evaluation script
│
├── utils/
│   ├── common_utils.py     # Utility functions
│   ├── data_utils.py       # Data loading and preprocessing
│   └── ...
│
├── main.py                 # Main script for training and evaluation
├── requirements.txt        # List of required packages
└── README.md               # This file

Getting Started

Installation

  1. Clone the repository:

    git clone https://github.com/your-repo/MiniConGTS.git
    cd MiniConGTS
  2. Install dependencies:

    pip install -r requirements.txt

Preparing the Data

  1. Place your datasets in the ./data/ directory following the provided structure.

Training the Model

  1. Configure training parameters in the main.py script or pass them as command-line arguments.

  2. Run the training script:

    python main.py --max_sequence_len 100 --batch_size 16 --epochs 2000 --dataset res14

    for more parameter setting:

    python main.py \
     --max_sequence_len 100 \
     --sentiment2id "{'negative': 2, 'neutral': 3, 'positive': 4}" \
     --model_cache_dir "./modules/models/" \
     --model_name_or_path "roberta-base" \
     --batch_size 16 \
     --device "cuda" \
     --prefix "./data/" \
     --data_version "D1" \
     --dataset "res14" \
     --bert_feature_dim 768 \
     --epochs 2000 \
     --class_num 5 \
     --task "triplet" \
     --model_save_dir "./modules/models/saved_models/" \
     --log_path "./logs/training_log.log" \
     --learning_rate 1e-3 \
     --warmup_steps 500 \
     --weight_decay 0.01
    
    

Alternatively, you can start your jupyter kernal and debug each intermidiate step easily in a notebook using:

main.ipynb

Evaluation

The model is evaluated on the test set after training. The results, including metrics such as accuracy, precision, recall, and F1-score, are logged to a file specified in the log_path.

Citation

If you use this code in your research, please cite the paper as follows:

@article{yourpaper2024,
  title={MiniConGTS: A Near Ultimate Minimalist Contrastive Grid Tagging Scheme for Aspect Sentiment Triplet Extraction},
  author={Your Name},
  journal={Journal Name},
  year={2024}
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Special thanks to the authors and contributors of the transformers library by Hugging Face.

minicongts's People

Contributors

qiaosun22 avatar sunqiaoo avatar

Watchers

 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.