Predicting the Popularity of Reddit Posts with AI

Social media creates crucial mass changes, as popular posts and opinions cast a significant influence on users' decisions and thought processes. For example, the recent Reddit uprising inspired by r/wallstreetbets which had remarkable economic impact was started with a series of posts on the thread. The prediction of posts that may have a notable impact will allow for the preparation of possible following trends. This study aims to develop a machine learning model capable of accurately predicting the popularity of a Reddit post. Specifically, the model is predicting the number of upvotes a post will receive based on its textual content. I experimented with three different models: a baseline linear regression model, a random forest regression model, and a neural network. I collected Reddit post data from an online data set and analyzed the model's performance when trained on a single subreddit and a collection of subreddits. The results showed that the neural network model performed the best when the loss of the models were compared. With the use of a machine learning model to predict social trends through the reaction users have to post, a better picture of the near future can be envisioned.


Introduction
Reddit is a social media platform where individuals join subreddit, which are communities loosely based around a topic, such as dance. In the subreddit, users can make posts with images and text which other users can react to with upvotes and downvotes, which are approval and disapproval respectively. With the growing influence of social media on societal decisions and mindsets, predicting which posts will gain a large reaction is an important task.
This study is an attempt to predict the number of Reddit upvotes that a post will receive based on its textual content. I used public data of the top 1000 posts from 2500 subreddits. I then use three different machine learning models: a linear regression model, a random forest regression model, and a neural network model to evaluate the combined text of the title and the post caption. I compared the loss of each of these models when predicting the number of upvotes to determine which is most effective.

Related Work
The prediction of Reddit upvotes on posts allows technical applications in the prediction of huge trends on social media, following the recent surge of r/wallstreetbets against Melvin Capital hedge fund over GME(gamestop). An example analyzed in close detail by Wolfsled et al. [1] is the 'Arab Spring', a huge progression of uprisings against oppressive government systems with an emphasis on social media, the platform used to organize protests and spread information freely. Prediction through the analysis of social media has been trending with the vast amount of data now available, and Schoen et al. [2] explore this with the prediction of future events and development in various fields, such as politics, finance, and more. There has been further research done into which fields can be predicted with social media and the techniques used for them by Yu and Kak [5].

arXiv:2106.07380v2 [cs.LG] 17 Jun 2021
Recently, the importance of social media trends specifically on Reddit was shown with the investor movement started by the subreddit r/WallStreetBets. The investors started a short squeeze against major hedge funds, pushing stocks such as GME(Gamestop) from 5 USD in July 2020 to a maximum of 483 USD on 28 January 2021. This resulted in huge losses for the hedge funds and more impacts, as studied by Lyócsa et al [9]. The use of social power and movements with economic impact for the Reddit event has also been analyzed by Di Muzio [6]. This research shows how social trends and movements have huge impacts from an economic standpoint, and can be applied to other fields as well. The people who participated in this wave were also analyzed by Hasso et al [7]. obtaining results showing a wave of people drawn to investing through a social as opposed to capital motivated movement.
The popularity of Reddit comments has been predicted by Deaton et al [4]. with the use of several machine learning models, such as Linear SVM, Decision Tree, and Naive Bayes. The models were trained on 53M comments to predict the hotness of a comment using relative confidence scores. There have been multiple papers on predicting the popularity of Reddit posts, with multiple models by Rohlin [8]. This paper uses Bag of Words, TF-IDF(Term Frequency-Inverse Document Frequency), and LDA(Latent Dirichlet Allocation) trained on features extracted with Naive Bayes and SVM. Segall and Zamoschin [3] also experimented by using Multiclass Naive Bayes. Multiclass SVM, and Linear Regression. I will build off these previous models analyzed to create a model that can more accurately predict the popularity of a Reddit post.

Dataset
The dataset that was used for this study is the Reddit Top 2.5 Million[] dataset on Github, which is a compilation of the top 1000 all-time posts from the top 2500 subreddits as of August 2013. The data is divided into 1000 row csv files by subreddit with features such as the time created, the score(upvotes -downvotes received), the title, selftext, and more. I removed unnecessary features, and kept the following: Subreddits are based around different topics, such as the r/acting subreddit which is located in the respective acting.csv file.

Metrics
The metric used to evaluate every model is RMSE, defined as: Given the residuals -the error of each prediction -the standard deviation is taken, resulting in RMSE which essentially returns how much the model's prediction is off by and is sought to be minimized.

Data Preprocessing
In order to evaluate the models, I preprocessed the data by cleaning the text. I removed stopwords, or unimportant words using regex and the NLTK stopword collection. I first used only one csv: acting.csv which contains the top 1000 posts of the r/acting subreddit. I repeated these methods upon a combined Pandas Dataframe that contained all 2500 csv files.

Baseline Linear Regression
A Linear Regression linear model was used as the baseline for the experiment. The Linear Regression model had an ordinary least squares loss objective and calculated the intercept of the model. As a baseline model, the linear regression model indicates the existence of more robust algorithms. One algorithm that fits this description is the Random Forest Regression Algorithm.

Random Forest Regression
Random Forest Regression improves upon the baseline linear regression model with the use of decision trees as opposed to a line of best fit. Random Forest Regression models use multiple independent decision trees and average the results in order to produce the ending prediction. This allows the model to outperform an individual decision tree due to having multiple independent trees from which mistakes are protected against simply due to their numbers. In direct contrast to the linear regression model, the Random Forest Regression model is able to find nonlinear interactions between the text and the number of upvotes. However, deep learning also provides another way to perform this task.

Neural Network
To improve the Random Forest Regression model, I experimented with a neural network model. Neural networks use several algorithms as 'layers' while mimicking the human brain in order to analyze an input and output a single prediction. The architecture of the model is shown below:    This graph shows the RMSE evaluation of the models on the combined data, and shows that the neural network performed the best, and the linear regression model performed better than the random forest regression model.
In both instances, the Neural Network had the lowest loss and thus performed better than the other models.

Discussion
In order to accurately predict the popularity of a post I needed to decide which metric would best indicate this, between the number of upvotes received, the number of downvotes received, or the score, the number of downvotes subtracted from the number of upvotes. A high number of downvotes signals a post that a majority of users disagree or dislike. A high score indicates that more people agreed with the post than disagreed. However, popular posts with evenly split opinions will have a low score, in the same way that unpopular posts will have a low score due to no attraction. As such, I decided that using the number of upvotes was the best feature to predict as it indicates a popular post with the majority of users agreeing.
One outlier in the results is the RMSE of the Random Forest Regression model on the combined data as opposed to the linear regression model. This may have been caused by the fact that linear regression models can extrapolate while tree-based models like the Random Forest regression model cannot. However, this was most likely caused by irregular data, as the Random Forest regression model outperforms the linear regression model for the acting.csv showing that the selection of subreddits as data influences the performance of the models.

Conclusion & Future Work
In this paper, I used Reddit post data in order to evaluate three different models that predicted the upvotes of a Reddit post based on the combined text data available. I used a linear regression model as a baseline due to its simple implementation. I then implemented a random forest regression model in order to capture the non-linear relationship between the text content of the post and the number of upvotes it would receive. Finally, I used a neural network model that would further improve on the random forest regression model by tuning hyperparameters and incorporating deep learning.
In the future, different models will be able to achieve lower loss in the prediction of popularity. Recurrent Neural Networks(RNN) and BERT by Google are two models that can be implemented with this task due to their applications in NLP fields. Additionally, using a larger quantity of data or more recent data would yield more accurate results, which can be achieved by scraping public data. The current neural network model can also be improved by implementing a different architecture, with the inclusion of Long-Short Term Memory(LSTM) layers or Gated Recurrent Units(GRU).

Acknowledgements
Special thanks to mentor Jonathan Mak for giving invaluable insight into neural network techniques and constructive paper revision. Additional thanks to mentor Mayuka Sarukkai for helping during the revision process.