Skip to content

A Self-Supervised Contrastive Learning Framework for Aspect Detection

License

Notifications You must be signed in to change notification settings

tshi04/AspDecSSCL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AspDecSSCL

A Self-Supervised Contrastive Learning Framework for Aspect Detection

image image image image image image

This repository is a pytorch implementation for the following AAAI'21 paper:

Tian Shi, Liuqing Li, Ping Wang, Chandan K. Reddy

Video Presentation

Requirements

  • Python 3.6.9
  • argparse=1.1
  • torch=1.4.0
  • sklearn=0.22.2.post1
  • numpy=1.18.2
  • gensim=3.8.3

Dataset

You can download processed dataset from here. Place them along side with AapDecSSCL.

|--- AspDecSSCL
|--- Data
|    |--- bags_and_cases
|    |--- restaurant
|    |    |--- dev.txt
|    |    |--- test.txt
|    |    |--- train.txt
|    |    |--- train_w2v.txt
|--- cluster_results (results, automatically build)
|--- nats_results (results, automatically build)
|

Train your model from scratch

Prepare word and aspect embeddings.

Train word2vec: python3 run.py --task word2vec

Run Kmeans: python3 run.py --task kmeans

Check Kmeans Keywords python3 run.py --task kmeans-keywords

Self-supervised Learning (Teacher Model)

SSCL Training python3 run.py --task sscl-train

Before validation, you need to perform aspect mapping. There is a file aspect_mapping.txt in nats_results. For general, please change nomap to none. Other aspects should use their names. Please check test.txt to validate the names.

SSCL validation python3 run.py --task sscl-validate

SSCL testing python3 run.py --task sscl-test

SSCL evaluate python3 run.py --task sscl-evaluate

SSCL teacher python3 run.py --task sscl-teacher

SSCL clean results python3 run.py --task sscl-clean

Student Model

SSCLS training python3 run.py --task student-train

SSCLS validation python3 run.py --task student-validate

SSCLS testing python3 run.py --task student-test

SSCLS testing python3 run.py --task student-evaluate

SSCLS clean python3 run.py --task student-clean

Citation

@article{shi2020simple,
  title={A Simple and Effective Self-Supervised Contrastive Learning Framework for Aspect Detection},
  author={Shi, Tian and Li, Liuqing and Wang, Ping and Reddy, Chandan K},
  journal={arXiv preprint arXiv:2009.09107},
  year={2020}
}

About

A Self-Supervised Contrastive Learning Framework for Aspect Detection

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages