Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fhamborg/newsmtsc
Target-dependent sentiment classification in news articles reporting on political events. Includes a high-quality data set of over 11k sentences and a state-of-the-art classification model.
https://github.com/fhamborg/newsmtsc
cuda dataset deep-learning news-articles pytorch sentiment-analysis sentiment-classification text-classification tsc
Last synced: 3 days ago
JSON representation
Target-dependent sentiment classification in news articles reporting on political events. Includes a high-quality data set of over 11k sentences and a state-of-the-art classification model.
- Host: GitHub
- URL: https://github.com/fhamborg/newsmtsc
- Owner: fhamborg
- License: other
- Created: 2021-04-08T11:47:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-20T16:17:09.000Z (11 months ago)
- Last Synced: 2024-05-01T19:23:57.836Z (7 months ago)
- Topics: cuda, dataset, deep-learning, news-articles, pytorch, sentiment-analysis, sentiment-classification, text-classification, tsc
- Language: Python
- Homepage:
- Size: 4.59 MB
- Stars: 132
- Watchers: 7
- Forks: 20
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# NewsMTSC: (Multi-)Target-dependent Sentiment Classification in News Articles
NewsMTSC is a dataset for target-dependent sentiment classification (TSC) on
news articles reporting on policy issues. The dataset consists of more than 11k labeled
sentences, which we sampled from news articles from online US news outlets. More
information can be found in our paper published at the EACL 2021.This repository contains the **dataset** for target-dependent
sentiment classification in news articles reporting on policy issues. Additionally,
the repository contains our **model** named GRU-TSC, which achieves state-of-the-art
TSC classification performance on NewsMTSC. Check it out - it **works out of the box** :-)# Quick start
* **I want to classify sentiment**: check out our easy-to-use, high-quality sentiment classifier on [PyPI](https://pypi.org/project/NewsSentiment/)
* **I need the dataset**: you can [download it here](https://github.com/fhamborg/NewsMTSC/raw/main/NewsSentiment/controller_data/datasets/NewsMTSC-dataset/NewsMTSC-dataset.zip) or [view it here](https://github.com/fhamborg/NewsMTSC/tree/main/NewsSentiment/controller_data/datasets/NewsMTSC-dataset). We also offer NewsMTSC as a dataset on [Huggingface Hub](https://huggingface.co/datasets/fhamborg/news_sentiment_newsmtsc) and on [Kaggle](https://www.kaggle.com/fhamborg/news-articles-sentiment).
* **I want to train my own models**: read the remainder of this file.Reminder: the following description is only relevant if you in fact want to train your own models. If that's not the case, please check above for links to the dataset and our easy-to-use python package.
# Installation
It's super easy, we promise! Note that following these instructions is only necessary if you're planning to train a model using our tool. If you only want to predict the sentiment of sentences, please use our [Python package](https://pypi.org/project/NewsSentiment/), which is even easier to install and use :-)NewsMTSC was tested on MacOS and Ubuntu; other OS may work, too. Let us know :-)
**1. Setup the environment:**
This step is optional if you have Python 3.8 installed already (`python --version`). If you don't have Python 3.8, we recommend using Anaconda for setting up requirements. If you do not have it yet, follow Anaconda's
[installation instructions](https://docs.anaconda.com/anaconda/install/).To setup a Python 3.8 environment (in case you don't have one yet) you may use, for example:
```bash
conda create --yes -n newsmtsc python=3.8
conda activate newsmtsc
```FYI, for users of virtualenv, the equivalent command would be:
```bash
virtualenv -ppython3.8 --setuptools 45 venv
source venv/bin/activate
```Note: We recommend Python 3.8, however we have successfully tested NewsMTSC with Python version >=3.8, <3.12.
**2. Setup NewsMTSC:**
```bash
git clone [email protected]:fhamborg/NewsMTSC.git
```Afterward, for example, open the project in your IDE and follow the instruction described in the section "Training".
Note that if you only want to classify sentiment using our model, we recommend that you use our PyPI package [NewsSentiment](https://pypi.org/project/NewsSentiment/). Getting it is as simple as `pip install NewsSentiment` and using it is four lines of code :-)
# Training
If you want to train one of our models or your own model, please clone the repository first.There are two entry points to the system. `train.py` is used to train and evaluate a specific model on a specific dataset using
specific hyperparameters. We call a single run an _experiment_. `controller.py` is used to run multiple experiments
automatically. This is for example useful for model selection and evaluating hundreds or thousands of combinations of
models, hyperparameters, and datasets.## Running a single experiment
Goal: training a model with a user-defined (hyper)parameter combination.`train.py` allows fine-grained control over the training and evaluation process, yet for most command line arguments
we provide useful defaults. Two arguments are required:* `--own_model_name` (which model is used, e.g., `grutsc`),
* `--dataset_name` (which dataset is used, e.g., `newsmtsc-rw`).For more information refer to `train.py` and
`combinations_absadata_0.py`. If you just want to get started quickly, the command below should work out of the box.```
python train.py --own_model_name grutsc --dataset_name newsmtsc-rw
```## Running multiple experiments
Goal: finding the (hyper)parameter combination to train a model that achieves the best performance.`controller.py` takes a set of values for each argument, creates combinations of arguments, applies conditions to remove
unnecessary combinations (e.g., some arguments may only be used for a specific model), and creates a multiprocessing
pool to run experiments of these argument combinations in parallel. After completion, `controller.py` creates a summary,
which contains detailed results, including evaluation performance, of all experiments. By using `createoverview.py`, you
can export this summary into an Excel spreadsheet.# Support
If you have questions on how to use NewsMTSC or its library, please create a new [issue](https://github.com/fhamborg/NewsMTSC/issues) on GitHub. Please understand that we are not able to provide individual support via email. We think that help is more valuable if it is shared publicly so that more people can benefit from it.# Acknowledgements
This repository is in part based on [ABSA-PyTorch](https://github.com/songyouwei/ABSA-PyTorch).
We thank Song et al. for making their excellent repository open source.# How to cite
If you use the dataset or model, please cite our [paper](https://www.aclweb.org/anthology/2021.eacl-main.142/) ([PDF](https://www.aclweb.org/anthology/2021.eacl-main.142.pdf)):```
@InProceedings{Hamborg2021b,
author = {Hamborg, Felix and Donnay, Karsten},
title = {NewsMTSC: (Multi-)Target-dependent Sentiment Classification in News Articles},
booktitle = {Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics (EACL 2021)},
year = {2021},
month = {Apr.},
location = {Virtual Event},
}
```