Giter Club home page Giter Club logo

emotion_analysis_twitter's Introduction

Emotion_Analysis_Twitter

Code for:

Understanding the Role of Affect Dimensions in DetectingEmotions from Tweets: A Multi-task Approach (Submitted to SIGIR, Under Review)

Setting up:

pip install -r requirements.txt

Preparing dataset:

add the train, val and test csv files to data/ folder

How to run:

For scraping/hydrating:

python scrape.py -s True -q [queries] -l [limit on tweets]  
python scrape.py -H True -f [files containing tweets ids]

Note : The -H stands for hydration, and -s for scraping. Restrictions related to coordinates, time intervals, can be modified directly in the script.

For training :

python train.py --exp_name (value) --encoder (value) --data_dir (value) --save_dir (value) --lr (value) --batch_size (value) --save_policy (value) --activation (value) --optim (value) --wd (value) --epochs (value) --seed (value) --use_gpu(to use gpu) --use_empath(to use empath) --l2(to use l2 reg.) --use_scheduler(to use sched) --use_dropout(to use dropout)

For generating predictions :

python generate_predictions.py --gpu_id (gpu_id) --model_name (BERT/ROBERTA) --model_path (path to saved model) --output_path (path to save dir) --data (path to dir containing hydrated csv) --use_empath (y/n) --activation (tanh/bce)

For plotting graphs :

python plot.py -f (csv_or_tsv_file_with_predictions) -i(unique_id_field) -d(date_field) -e(field_with_emotion_predictions) -b(text_field) -l(boolean_flag_for_leap_year) -t(timestep_for_type_2) -c(chunk_size_for_type_1) -a(address_of_aspect_file)
Note-1: Plot types: (1)Fixed number of tweets, (2)Fixed time interval, (3)Aspect mentions (for fixed number of tweets out of the total)  
Note-2: By default the aspect term searching is case sensitive
Note-3: Aspects labels can be supplied in the code

New flags:

  • --save_pickle ; to create dataset_{ENCODER}.pkl file
  • --load_pickle PATH ; path to pickle file
  • --job_type ; mtl, stl_emotion, stl_VAD
  • --final_test ; boolean flag to combine train and val set to generate final test

Saving scheme:

  • final_test=false, stores best validation epoch
  • final_test=true, stores test result after training on best validation hp.json

emotion_analysis_twitter's People

Contributors

aa11 avatar atharva-naik avatar kushal2000 avatar rajdeep345 avatar sriyash421 avatar

Stargazers

 avatar  avatar

Watchers

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