Case study 1 – Predicting stock prices based on social media
Our first case study will be quite exciting! We will attempt to predict the price of the stock of a publicly traded company using only social media sentiment. While this example will not use any explicit statistical/machine learning algorithms, we will utilize exploratory data analysis (EDA) and use visuals in order to achieve our goal.
Text sentiment analysis
When talking about sentiment, it should be clear what is meant. By sentiment, I am referring to a quantitative value (at the interval level) between -1 and 1. If the sentiment score of a text piece is close to -1, it is said to have negative sentiment. If the sentiment score is close to 1, then the text is said to have positive sentiment. If the sentiment score is close to 0, we say it has neutral sentiment. We will use a Python module called TextBlob
to measure our text sentiment:
from textblob import TextBlob# use the textblob module to make a function called stringToSentiment...