Code for "Adversarial Training for a Hybrid Approach to Aspect-Based Sentiment Analysis

Overview

HAABSAStar

Code for "Adversarial Training for a Hybrid Approach to Aspect-Based Sentiment Analysis". This project builds on the code from https://github.com/ofwallaart/HAABSA and https://github.com/mtrusca/HAABSA_PLUS_PLUS.

All software is written in PYTHON3 (https://www.python.org/) and makes use of the TensorFlow framework (https://www.tensorflow.org/).

Installation Instructions (Windows):

Dowload required files and add them to data/externalData folder:

  1. Download ontology: https://github.com/KSchouten/Heracles/tree/master/src/main/resources/externalData
  2. Download SemEval2015 Datasets: http://alt.qcri.org/semeval2015/task12/index.php?id=data-and-tools
  3. Download SemEval2016 Dataset: http://alt.qcri.org/semeval2016/task5/index.php?id=data-and-tools
  4. Download Glove Embeddings: http://nlp.stanford.edu/data/glove.42B.300d.zip
  5. Download Stanford CoreNLP parser: https://nlp.stanford.edu/software/stanford-parser-full-2018-02-27.zip
  6. Download Stanford CoreNLP Language models: https://nlp.stanford.edu/software/stanford-english-corenlp-2018-02-27-models.jar

Setup Environment

  1. Install chocolatey (a package manager for Windows): https://chocolatey.org/install
  2. Open a command prompt.
  3. Install python3 by running the following command: code(choco install python) (http://docs.python-guide.org/en/latest/starting/install3/win/).
  4. Make sure that pip is installed and use pip to install the following packages: setuptools and virtualenv (http://docs.python-guide.org/en/latest/dev/virtualenvs/#virtualenvironments-ref).
  5. Create a virtual environemnt in a desired location by running the following command: code(virtualenv ENV_NAME)
  6. Direct to the virtual environment source directory.
  7. Unzip the zip file of this GitHub repository in the virtual environment directrory.
  8. Activate the virtual environment by the following command: 'code(Scripts\activate.bat)`.
  9. Install the required packages from the requirements.txt file by running the following command: code(pip install -r requirements.txt).
  10. Install the required space language pack by running the following command: code(python -m spacy download en)

Note: the files BERT768embedding2015.txt and BERT768embedding2016.txt are too large for GitHub. These can be generated using getBERTusingColab.py.

Configure paths

The following scripts contain file paths to adapt to your computer (this is done by adding the path to you virtual environment before the filename. For example "/path/to/venv"+"data/programGeneratedData/GloVetraindata"): main_cross.py, main_hyper.py, config.py, HyperDataMaker.py, adversarial.py.

Run Software

  1. Configure one of the three main files to the required configuration (main.py, main_cross.py, main_hyper.py)
  2. Run the program from the command line by the following command: code(python PROGRAM_TO_RUN.py) (where PROGRAM_TO_RUN is main/main_cross/main_hyper)

Software explanation:

The environment contains the following main files that can be run: main.py, main_cross.py, main_hyper.py

  • main.py: program to run single in-sample and out-of-sample valdition runs. Each method can be activated by setting its corresponding boolean to True e.g. to run the Adversarial method set runAdversarial= True.

  • main_cross.py: similar to main.py but runs a 10-fold cross validation procedure for each method.

  • main_hyper.py: program that is able to do hyperparameter optimzation for a given space of hyperparamters for each method. To change a method change the objective and space parameters in the run_a_trial() function.

  • config.py: contains parameter configurations that can be changed such as: dataset_year, batch_size, iterations.

  • dataReader2016.py, loadData.py: files used to read in the raw data and transform them to the required formats to be used by one of the algorithms

  • lcrModel.py: Tensorflow implementation for the LCR-Rot algorithm

  • lcrModelAlt.py: Tensorflow implementation for the LCR-Rot-hop algorithm

  • lcrModelInverse.py: Tensorflow implementation for the LCR-Rot-inv algorithm

  • cabascModel.py: Tensorflow implementation for the CABASC algorithm

  • OntologyReasoner.py: PYTHON implementation for the ontology reasoner

  • svmModel.py: PYTHON implementation for a BoW model using a SVM.

  • adversarial.py: Tensorflow implementation of adversarial training for LCR-Rot-hop

  • att_layer.py, nn_layer.py, utils.py: programs that declare additional functions used by the machine learning algorithms.

Directory explanation:

The following directories are necessary for the virtual environment setup: __pycache, \Include, \Lib, \Scripts, \tcl, \venv

  • cross_results_2015: Results for a k-fold cross validation process for the SemEval-2015 dataset
  • cross_results_2016: Results for a k-fold cross validation process for the SemEval-2015 dataset
  • Results_Run_Adversarial: If WriteFile = True, a csv with accuracies per iteration is saved here
  • data:
    • externalData: Location for the external data required by the methods
    • programGeneratedData: Location for preprocessed data that is generated by the programs
  • hyper_results: Contains the stored results for hyperparameter optimzation for each method
  • results: temporary store location for the hyperopt package

Changed files with respect to https://github.com/mtrusca/HAABSA_PLUS_PLUS:

  • main.py
  • main_hyper.py
  • main_cross.py
  • config.py
  • adversarial.py (added)
End-to-end Temporal Action Detection with Transformer. [Under review]

TadTR: End-to-end Temporal Action Detection with Transformer By Xiaolong Liu, Qimeng Wang, Yao Hu, Xu Tang, Song Bai, Xiang Bai. This repo holds the c

Xiaolong Liu 105 Dec 25, 2022
Vehicle Detection Using Deep Learning and YOLO Algorithm

VehicleDetection Vehicle Detection Using Deep Learning and YOLO Algorithm Dataset take or find vehicle images for create a special dataset for fine-tu

Maryam Boneh 96 Jan 05, 2023
CVPR 2021: "The Spatially-Correlative Loss for Various Image Translation Tasks"

Spatially-Correlative Loss arXiv | website We provide the Pytorch implementation of "The Spatially-Correlative Loss for Various Image Translation Task

Chuanxia Zheng 89 Jan 04, 2023
[ICLR'21] Counterfactual Generative Networks

This repository contains the code for the ICLR 2021 paper "Counterfactual Generative Networks" by Axel Sauer and Andreas Geiger. If you want to take the CGN for a spin and generate counterfactual ima

88 Jan 02, 2023
Fast, Attemptable Route Planner for Navigation in Known and Unknown Environments

FAR Planner uses a dynamically updated visibility graph for fast replanning. The planner models the environment with polygons and builds a global visi

Fan Yang 346 Dec 30, 2022
Local Multi-Head Channel Self-Attention for FER2013

LHC-Net Local Multi-Head Channel Self-Attention This repository is intended to provide a quick implementation of the LHC-Net and to replicate the resu

12 Jan 04, 2023
RODD: A Self-Supervised Approach for Robust Out-of-Distribution Detection

RODD Official Implementation of 2022 CVPRW Paper RODD: A Self-Supervised Approach for Robust Out-of-Distribution Detection Introduction: Recent studie

Umar Khalid 17 Oct 11, 2022
A PyTorch implementation of EfficientDet.

A PyTorch impl of EfficientDet faithful to the original Google impl w/ ported weights

Ross Wightman 1.4k Jan 07, 2023
Implementation for paper LadderNet: Multi-path networks based on U-Net for medical image segmentation

Implementation for paper LadderNet: Multi-path networks based on U-Net for medical image segmentation This implementation is based on orobix implement

Juntang Zhuang 116 Sep 06, 2022
Reimplement of SimSwap training code

SimSwap-train Reimplement of SimSwap training code Instructions 1.Environment Preparation (1)Refer to the README document of SIMSWAP to configure the

seeprettyface.com 111 Dec 31, 2022
This project uses Template Matching technique for object detecting by detection of template image over base image.

Object Detection Project Using OpenCV This project uses Template Matching technique for object detecting by detection the template image over base ima

Pratham Bhatnagar 7 May 29, 2022
Ensembling Off-the-shelf Models for GAN Training

Vision-aided GAN video (3m) | website | paper Can the collective knowledge from a large bank of pretrained vision models be leveraged to improve GAN t

345 Dec 28, 2022
Introducing neural networks to predict stock prices

IntroNeuralNetworks in Python: A Template Project IntroNeuralNetworks is a project that introduces neural networks and illustrates an example of how o

Vivek Palaniappan 637 Jan 04, 2023
Rethinking Transformer-based Set Prediction for Object Detection

Rethinking Transformer-based Set Prediction for Object Detection Here are the code for the ICCV paper. The code is adapted from Detectron2 and AdelaiD

Zhiqing Sun 62 Dec 03, 2022
Tool for installing and updating MiSTer cores and other files

MiSTer Downloader This tool installs and updates all the cores and other extra files for your MiSTer. It also updates the menu core, the MiSTer firmwa

72 Dec 24, 2022
Fake News Detection Using Machine Learning Methods

Fake-News-Detection-Using-Machine-Learning-Methods Fake news is always a real and dangerous issue. However, with the presence and abundance of various

Achraf Safsafi 1 Jan 11, 2022
[EMNLP 2020] Keep CALM and Explore: Language Models for Action Generation in Text-based Games

Contextual Action Language Model (CALM) and the ClubFloyd Dataset Code and data for paper Keep CALM and Explore: Language Models for Action Generation

Princeton Natural Language Processing 43 Dec 16, 2022
Model Zoo for MindSpore

Welcome to the Model Zoo for MindSpore In order to facilitate developers to enjoy the benefits of MindSpore framework, we will continue to add typical

MindSpore 226 Jan 07, 2023
Tensors and neural networks in Haskell

Hasktorch Hasktorch is a library for tensors and neural networks in Haskell. It is an independent open source community project which leverages the co

hasktorch 920 Jan 04, 2023
Make your AirPlay devices as TTS speakers

Apple AirPlayer Home Assistant integration component, make your AirPlay devices as TTS speakers. Before Use 2021.6.X or earlier Apple Airplayer compon

George Zhao 117 Dec 15, 2022