Get insights by detecting emotional tone with AI
Sentiment analysis is classifying the mood or intent of a text as positive or negative. This is usually performed by training machine learning models, also termed as classifiers, on sample texts.
The model used in this simple demonstrator is based on a deep neural network supported by a pre-trained language model. This demonstrator can predict the text sentiment using 5 stars. It differs from the “classic” examples of sentiment analysis models, because it does not use a binary classification, but instead it uses 5 stars. 1-star indicates an extremely negative sentiment and 5-stars an extremely positive one.
This model was trained using the fast.ai library and a data set provided by Yelp. The data set can be downloaded from here: https://s3.amazonaws.com/fast-ai-nlp/yelp_review_full_csv.tgz. It contains 1,569,264 samples from the Yelp Dataset Challenge 2015. This full dataset has 130,000 training samples and 10,000 testing samples for each star.
The algorithm used for training the sentiment analysis model for this demo is called “ULMFiT” and was developed by Jeremy Howard and Sebastian Ruder. As per ULMFiT algorithm, a pre-trained language model was downloaded and fine tuned with the Yelp data set. The encoder of this fine tuned model was then paired with a classifier and refined further for sentiment analysis.
Click on the link below and analyse the sentiment of your text. Have fun looking at a machine analyse sentiments for you!
This small demo was written using React for the user interface and Flask for implementing the REST API, which interfaces with a sentiment classifier deep learning model.