Goal: classify the sentiment (mood) of tweets scraped from twitter
-
get familiar with twitter scraper library in python
-
gather data!! (we need LOTS of tweets)
-
Figure out how we will label the data
-
identify NLP libs to use in order to determine which features of these tweets we want to use to train/test our model. (this will require playing around with some NLP libraries!)
-
try out different classification models that have been trained on our data
-
choose the best classification model based on success metrics (accuracy, precision, sensitivity, etc.)
We need a library that will allow us to pull thousands and thousands of tweets. We need a lot of data to train an accurate model! Here are some resources to help us figure that out, but we need to do some more research:
tweet_scraper.py contains the code used for creating our datasets, which we store as pickle files in the data/ folder.
see bag_of_words.py file. Be sure to run
python -m spacy download en_core_web_sm
in your terminal before running this file.
See train_textcat.py, a copy of an example text categorizer from the spaCy documentation. Look into spaCy's models that can be trained/saved/loaded for our task.
To run train_textcat.py:
-
python -m spacy download en_core_web_sm -
python train_textcat.py -m en_core_web_sm
Another idea: we could create word vectors and use a more traditional classifier?? (such as decision tree, SVM, bagging/boosting, etc).
86.2% using all 10000+ words with C=0.1 87.1% using most important 4000 words with C=0.1 87.4% using most important 2000 words with C=0.1 89.3% using most important 1000 words with C=0.1