-1

I want to build an app where I can enter any Twitter keywords, the backend will crawl related tweets and return sentiment analysis of the tweets in percentage of negative, neutral and positive tweets. For example, I enter the keyword 'pepsi', the app will output something like this: Tweets related to pepsi contains 10% negative sentiment, 10% neutral sentiment and 80% of positive review.

So the problem is how to train an machine learning algorithm that I can use in the backend to do such sentiment analysis on various kind of topics. The main idea involved here is transfer learning, where we train one model on large amount of labeled data and use it as baseline to train other data. Transfer learning has limits in NLP mostly because knowledge learned at one task is not broad enough to downstream to other tasks. For example, I pretrained a good neural network to do sentiment analysis on airlines with a prediction accuracy of over 70%. However, when I use the same model to do sentiment analysis on pepsi, I get only around 30% prediction accuracy.

I did some research and noticed that Google's universal sentence embedding is quite popular. However, I realized this is a new way of converting input text into feature vector, not a universal algorithm. I wonder anyone can point me to directions I should go? Thanks a lot in advance!

CathyQian
  • 1,081
  • 15
  • 30

1 Answers1

0

This paper from fast.ai claims that they have successfully used transfer learning for text classification task. You should have a look.

xashru
  • 3,400
  • 2
  • 17
  • 30
  • Thanks @xashru! I will check it out. – CathyQian Feb 04 '19 at 21:59
  • I found this tutorial [here](https://www.analyticsvidhya.com/blog/2018/11/tutorial-text-classification-ulmfit-fastai-library/) helpful in case anyone wants to give it a try starting from cleaned text stored in pandas dataframe. A short summary of the ULMFit model: start with a pretrained language model (not classification model), fine-tune the language model using your own data (which can have as small as 100 entries, labeled not needed at this stage), then extract the encoder from this fine tuned language model, pair it with a classifier, fine-tune the classifier (you need label here!). – CathyQian Feb 06 '19 at 23:30
  • As to answer to my initial question, the answer is no -- there is no such universal model which can do sentiment analysis without either further tuning in the specific domain you are interested in or labeling the data. The ULMFit performs quite well and keep in mind that you still need labeled data to evaluate the performance of the model. – CathyQian Feb 06 '19 at 23:32