#### The Problem

84.51° is a data analytics company that focuses on retail, branding, customer relations, and similar domains. At a recent hackathon hosted by the company, it was said that having a way to predict consumer demand for certain products could help their clients -- retail stores like Kroger -- prepare their inventory for future demand increases or decreases. Buying items in bulk before demand goes up or scaling down the purchase of items before demand goes down would save money for these stores, who could pass on those savings to their customers. But how can demand be predicted in advance?

#### The Solution

Our team decided to solve this problem of predicting consumer demand by analyzing Twitter tweets for sentiment towards certain products, identifying trends in sentiment over time, and predicting future trends using regression. Our application allowed users to enter a word or phrase, e.g. "Kraft cheese," which would retrieve the latest tweets that contained that word/phrase via the Twitter API. Each tweet was given a sentiment score -- a number between -1 (negative sentiment) and 1 (postive sentiment). The tweets were then grouped by day, and their scores were added up. For example, if there were two tweets on January 11th that read "I love Kraft cheese," and "Kraft cheese is great," they would each receive positive sentiment scores -- say .7 and .8 -- and the scores would be added to yield a total sentiment score of 1.5 for the day. The "trend" was calculated by subtracting the previous day's sentiment score from the current day's score -- so a sentiment score of 2.6 on January 12th would yield a trend of +1.1 (i.e. 2.6 - 1.5 = 1.1). These trends were plotted over time using Chart.js and a regression line was fit to the data. Based on the current short-term trend and the long-term regression model, a user could predict the future demand of product.
Screenshot of the trend graph.
Our team and some new friends.