🔒
Global Scientific Platform
Serving Researchers Since 2012

Machine Learning-Based Prediction of Emerging Trending Hashtags using Temporal and Engagement Features

DOI : 10.5281/zenodo.24153000
Download Full-Text PDF Cite this Publication

Text Only Version

Machine Learning-Based Prediction of Emerging Trending Hashtags using Temporal and Engagement Features

Shravni Bandodkar

Department of Computer Engineering Xavier Institute of Engineering Mumbai, India

Prisha Pereira

Department of Computer Engineering Xavier Institute of Engineering Mumbai, India

Rebecca Celine Sam

Department of Computer Engineering Xavier Institute of Engineering Mumbai, India

Teena Varma

Department of Computer Engineering Xavier Institute of Engineering Mumbai, India

Abstract – Social media platforms continuously generate large volumes of user-generated content, making automated identi- cation of emerging trends an important analytical problem. Twitter/X hashtags provide a useful representation of evolving public interests; however, high current popularity does not nec- essarily indicate that a hashtag will become trending in the near future. This study formulates future hashtag trend prediction as a supervised binary classication problem using temporal, activity, and engagement-based features derived from Twitter/X data. The feature set includes tweet count, retweet statistics, unique users, growth rate, tweet velocity, tweet acceleration, engagement rate, and trend score. Logistic Regression and Random Forest are evaluated using a chronological 80:20 train-test split with class weighting to address class imbalance. Logistic Regression obtains a ROC-AUC of 0.6058 and a PR-AUC of 0.0276, while Random Forest obtains a ROC-AUC of 0.6005 and a PR-AUC of 0.0261. Feature ablation experiments indicate that adding temporal fea- tures is associated with an increase in ROC-AUC, while threshold sensitivity experiments show decreasing predictive performance as the required future-growth threshold increases. These results demonstrate the feasibility of using temporal, activity, and engagement-based features for analysing future hashtag activity while highlighting the difculty of predicting rare future-trending events.

Index Termsmachine learning, hashtag trend prediction, Twitter analytics, Random Forest, Logistic Regression, temporal features, social media analytics

  1. Introduction

    Twitter/X continuously generates user-generated content in which hashtags are widely used to categorize discussions and connect posts around common topics. When hashtag activity increases substantially, a topic may gain visibility and become a trend. However, identifying hashtags that are likely to become trending in the future is more challenging than identifying hashtags that are already popular.

    The distinction between current popularity and future trend potential is important. A hashtag may have a large number of tweets because it is already well established, whereas another hashtag with a smaller current volume may be increasing rapidly and have greater potential to become a future trend. Consequently, prediction requires more than simple frequency- based ranking.

    Previous research has investigated hashtag recommendation, information retrieval, sentiment analysis, temporal analysis, brand review analysis, hashtag popularity prediction, and trend-promoter detection [1][8]. Studies have also applied Twitter data to sentiment and brand review analysis [9], [10]. These studies demonstrate that activity patterns, tem- poral information, contextual characteristics, user behaviour, and Twitter content can provide useful signals for analysing social media and hashtag dynamics. However, the prediction tasks and temporal granularity differ across these studies. For example, Ma et al. focused on the popularity of newly emerging hashtags, while Kausar et al. investigated trend- promoting users. Varma et al. studied real-time sentiment anal- ysis of Twitter data [9], while Varma et al. also investigated brand review analysis using Twitter data [10]. The present study addresses a more specic formulation by predicting future hashtag activity at the hashtag-hour level, using current activity, engagement characteristics, and short-term temporal dynamics such as growth, velocity, and acceleration.

    This work formulates future hashtag trend prediction as a supervised binary classication problem. Each observation represents a hashtag-hour instance, and the model uses multi- ple characteristics of activity and engagement. These include tweet count, retweet statistics, unique users, growth rate, tweet velocity, tweet acceleration, engagement rate, and trend score. Two supervised learning algorithms are investigated. Logis-

    tic Regression is selected as an interpretable baseline, while Random Forest is used to capture potentially nonlinear rela- tionships between the engineered features and future trending behaviour. Because future-trending observations represent only a small fraction of the dataset, class weighting is incorporated during training. Furthermore, a chronological 80:20 train-test split is used to preserve temporal ordering.

    The main objective of this work is to determine whether current and recent hashtag characteristics can be used to identify hashtag-hour observations that are likely to become trending in the following hour.

  2. Literature Review

    Research on Twitter hashtags has covered several related tasks, including hashtag recommendation, information re- trieval, temporal analysis, sentiment analysis, brand review analysis, large-scale Twitter corpus construction, hashtag pop- ularity prediction, and trend-promoter detection.

    Otsuka et al. proposed a hashtag recommendation system based on Hashtag Frequency-Inverse Hashtag Ubiquity (HF- IHU), together with Hadoop and MapReduce for large-scale Twitter data processing [1]. Although this work demonstrates the usefulness of frequency-based analysis and distributed processing, its primary objective is hashtag recommendation rather than future trend prediction.

    Lu and Lee proposed a Twitter hashtag recommendation approach that incorporates temporal clustering effects [2]. While temporal behaviour is explicitly considered, the task remains recommendation rather than supervised prediction of future trends.

    Dovgopol and Nohelty investigated hashtag recommenda- tion using k-Nearest Neighbors and Naive Bayes [3]. Their work demonstrates the applicability of machine learning to hashtag-related tasks, but focuses on recommendation based on similarity and classication.

    Varma et al. investigated real-time sentiment analysis of Twitter data using machine-learning and natural language processing approaches [9]. Their work demonstrates the ap- plication of automated analytical methods to Twitter content. However, the focus is on sentiment analysis rather than pre- dicting the future activity of individual hashtags.

    Varma et al. also investigated brand review analysis using a Twitter dataset [10]. This work applies Twitter data to the analysis of brand reviews, whereas the present study focuses on forecasting whether a hashtag will experience a signicant increase in activity during the following hour.

    Kywe et al. examined hashtag recommendation using user and tweet similarity together with TF-IDF-based methods [4]. Likewise, Efron studied hashtag retrieval in a microblogging environment using information-retrieval methods [5]. These approaches provide foundations for hashtag discovery but do not explicitly model future hashtag trend status.

    Ma et al. investigated the prediction of popularity for newly emerging hashtags by formulating the problem as a classication task [8]. Their study used seven content fea- tures and eleven contextual features derived from the social

    graph of users adoptig hashtags. Experiments were con- ducted on a Twitter dataset containing 31 million tweets from approximately 2 million Singapore-based users using classi- ers including Naive Bayes, k-Nearest Neighbors, decision trees, support vector machines, and Logistic Regression. The study highlighted the importance of contextual information for predicting hashtag popularity. In contrast, the present study focuses on hashtag-hour observations and incorporates short-term temporal features such as growth, velocity, and acceleration to predict whether a hashtag will experience a signicant increase in activity during the following hour.

    Kausar et al. introduced the Push-To-Trend framework for detecting users involved in promoting Twitter trends [6]. Their study evaluated machine learning models for identifying trend- promoting users using activity and textual characteristics. Although the work is related to trend formation, its objective is user-level trend-promoter detection rather than prediction of future trending status at the hashtag level.

    Tahir and Mehmood introduced Anbar, a large-scale Urdu Twitter corpus containing millions of tweets [7]. The work demonstrates the importance of large-scale Twitter data for social media analysis, but does not develop a machine-learning model for future hashtag trend prediction.

    Overall, existing studies address hashtag recommendation, retrieval, sentiment analysis, brand review analysis, popularity prediction, trend-promoter detection, and large-scale Twitter data analysis. However, these studies differ from the present work in their prediction granularity, temporal formulation, and feature representation. The present study focuses specically on predicting future hashtag activity at an hourly level by combining current activity, engagement characteristics, and short-term temporal dynamics.

  3. Methodology

    1. Dataset

      The study uses publicly available Twitter/X trending data obtained from the Kaggle dataset Twitter: Trending Tweets per week (updated weekly). The dataset contains information related to Twitter trends, including hashtag trends and tweet-level data. It provides three main les: all_trends_data.csv, hashtag_trends_data.csv, and twitter_trending_data.csv. The data was originally collected using the Twitter API.

      For this study, the available Twitter data was processed and aggregated at the hashtag-hour level. Each observation represents the activity of a particular hashtag during a specic hour. The preprocessing and feature-engineering pipeline gen- erated activity, engagement, and temporal features including tweet count, total and average retweets, unique users, average followers, previous-hour activity, growth rate, tweet velocity, tweet acceleration, retweet dynamics, engagement rate, and trend score.

      After preprocessing and feature construction, the resulting dataset contained 4,654,390 hashtag-hour observations. This

      TABLE I

      Comparison of Related Twitter Hashtag and Trend Studies

      Reference Technique / Focus Difference from the Present Study

      Otsuka et al. [1] HF-IHU, TF-IDF-based relevance,

      Hadoop and MapReduce

      Lu and Lee [2] Topics-over-Time, Mixed Membership

      Model, and temporal clustering

      Focuses on hashtag recommendation and large-scale processing rather than future hashtag trend prediction.

      Uses temporal information for hashtag recommendation but does not formulate next-hour future trend prediction.

      Dovgopol and Nohelty [3]

      k-Nearest Neighbors and Naive Bayes Applies machine learning to hashtag recommendation rather than predicting future

      hashtag activity.

      Kywe et al. [4] User/tweet similarity and TF-IDF-based recommendation

      Focuses on recommending relevant hashtags rather than forecasting future trend status.

      Efron [5] Information-retrieval techniques Concentrates on hashtag retrieval and does not address future temporal trend

      prediction.

      Kausar et al. [6] Machine learning for trend-promoter detection

      Identies trend-promoting users rather than predicting whether a hashtag will become more active in the following hour.

      Tahir and Mehmood [7]

      Large-scale Twitter data collection and corpus analysis

      Provides a large Twitter corpus but does not develop a model for future hashtag trend prediction.

      Ma et al. [8] Content and contextual features with supervised classication

      Varma et al. [9] Real-time Twitter sentiment analysis

      using machine learning and natural language processing

      Varma et al. [10] Brand review analysis using a Twitter

      dataset

      Predicts popularity of newly emerging hashtags using content and social-context features, whereas the present study uses hashtag-hour temporal dynamics for next-hour prediction.

      Focuses on sentiment analysis of Twitter content rather than predicting future hashtag activity.

      Focuses on brand review analysis rather than next-hour prediction of hashtag activity.

      Fig. 1. End-to-end Big Data Analytics and Machine Learning architecture for Twitter/X hashtag trend prediction.

      processed dataset was used for training and evaluating the ma- chine learning models for short-term hashtag trend prediction.

    2. Problem Formulation

      The prediction task is formulated as binary classication.

      Each hashtag-hour observation is assigned a target value

      y {0, 1}, (1)

      where y = 1 denotes future trending behaviour and y = 0

      denotes non-trending behaviour.

      The target is based on the change in tweet activity in the following hour. An observation is labelled as future trending when its tweet count increases by at least 50% in the next hour. Future-dependent variables used to calculate this label are excluded from the model input.

    3. Feature Set

      The machine-learning models use a combination of activity, temporal, and engagement features.

      1. Tweet Count: Tweet count represents the total number of tweets associated with a hashtag during a given hour.

      2. Retweet Statistics: Retweet-related measures capture the redistribution of content associated with the hashtag and provide additional information about activity and engagement.

      3. Unique Users: Unique-user count measures the number of participating users associated with a hashtag during the observation interval.

      4. Growth Rate: Growth rate measures the proportional change in tweet count compared with the preceding hour. It captures whether the hashtag is gaining or losing activity.

      5. Tweet Velocity: Tweet velocity measures the rst-order change in tweet activity and therefore represents the momen- tum of hashtag growth.

      6. Tweet Acceleration: Tweet acceleration captures the second-order change in tweet activity, indicating whether the rate of growth is itself increasing or decreasing.

      7. Engagement Rate: Engagement rate measures retweet intensity relative to tweet volume, providing a normalized indicator of engagement.

      8. Trend Score: Trend score is a composite indicator based on tweet count, total retweets, unique users, and tweet accel- eration. It provides an interpretable representation of overall trend-related activity.

    4. Temporal Feature Construction

      Hashtag activity is represented at hourly resolution. Spark window functions partition observations by hashtag and order them chronologically, allowing lag- and lead-based temporal features to be calculated.

      A complete hourly grid is constructed between the rst and last observed hour of each hashtag. Missing hours are represented by zero activity so that temporal calculations compare adjacent hours correctly.

    5. Target Construcion

      The future-trending target is constructed using the activity observed one hour ahead. If the following-hour tweet count increases by at least 50% relative to the current observation, the target is set to 1; otherwise it is set to 0.

      This formulation converts future trend prediction into a supervised classication problem while preserving a clear temporal prediction horizon.

    6. Leakage Prevention

      Future-dependent variables such as future tweet count and future growth values are not supplied to the machine-learning models. These variables are used only during target construc- tion and validation of the labeling process. Their removal prevents future information from leaking into model training.

    7. Logistic Regression

      Logistic Regression is used as the baseline model because it provides a relatively simple and interpretable classication approach. It provides a reference point against which the more exible ensemble model can be compared.

    8. Random Forest

      Random Forest is used to capture potentially nonlinear rela- tionships between the engineered features and future trending behaviour. The method combines multiple decision trees and provides both binary predictions and probability estimates.

    9. Class Imbalance

    Future-trending observations constitute a small proportion of the full dataset. To alleviate this class imbalance, class weighting is applied during model training to provide greater importance to the minority class.

  4. Experimental Setup

    1. Computational Framework

      The broader data pipeline uses Apache Spark and PySpark for data processing and feature engineering. The machine- learning models are trained and evaluated using Python and scikit-learn on the structured dataset produced by the prepro- cessing and feature-engineering stages.

    2. Training and Testing Strategy

      A chronological 80:20 train-test split is used.

      TABLE II Experimental Configuration

      Parameter Conguration

      Dataset size 4,654,390 observations

      Task Binary classication

      Train-test split 80:20

      Split strategy Chronological Baseline model Logistic Regression Main model Random Forest Class imbalance Class weighting Temporal resolution Hourly

      Framework Spark/PySpark + Python/scikit-learn

    3. Evaluation Metrics

    The models are evaluated using ROC-AUC, PR-AUC, pre- cision, recall, and F1-score.

    ROC-AUC assesses the models ranking ability of positive observations over negative observations at all classication thresholds.

    PR-AUC quanties the precision-recall trade-off and is of particular importance when positive observations are rare.

    Precision is the proportion of predicted positive observa- tions that are positively labelled.

    Recall is the proportion of actual positive observations correctly identied.

    F1-score is the harmonic mean of precision and recall.

    Fig. 2. Comparison of Logistic Regression and Random Forest using ROC- AUC, PR-AUC, precision, recall, and F1-score.

    TABLE III Standalone Model Performance

    Fig. 3. Temporal variation in tweet volume across the dataset.

    Model

    ROC-AUC

    PR-AUC

    Prec.

    Recall

    F1

    Logistic Regression

    0.6058

    0.0276

    0.0939

    0.2047

    0.1288

    Random Forest

    0.6005

    0.0261

    0.0927

    0.2099

    0.1286

  5. Results

    1. Model Comparison

      The standalone model evaluation results are presented in Table III.

      Logistic Regression obtains a ROC-AUC of 0.6058 and a PR-AUC of 0.0276, while Random Forest obtains a ROC- AUC of 0.6005 and a PR-AUC of 0.0261. The two models show similar performance across the evaluated metrics, with differences observed in precision, recall, and F1-score.

      Logistic Regression obtains a precision of 0.0939, recall of 0.2047, and F1-score of 0.1288. Random Forest obtains a precision of 0.0927, recall of 0.2099, and F1-score of 0.1286. These results indicate that model performance varies depending on the evaluation metric. Since the positive class is highly imbalanced, PR-AUC, precision, recall, and F1-score are considered alongside ROC-AUC to interpret the results.

    2. Temporal Activity

      Figure 3 presents the temporal variation in tweet volume across the dataset.

      The temporal representation illustrates variation in overall tweet activity across the observation period. This temporal variation motivates inclusion of historical activity and short- term temporal features in the future hashtag trend prediction task.

    3. User Participation and Tweet Activity

      Figure 4 illustrates the relationship between unique users and tweet volume across hashtag-hour observations.

      The positive relationship indicates that higher tweet activity is generally associated with participation from a larger number of unique users. This supports the use of both tweet-volume and user-participation measures as complementary activity features.

      Fig. 4. Relationship between unique users and tweet volume across hashtag- hour observations. Both variables are shown on a logarithmic scale to accommodate the highly skewed distributions of activity measures.

    4. Feature Group Ablation

      Figure 5 presents the ablation analysis conducted by pro- gressively adding feature groups. The experiments evaluate activity features, activity plus engagement features, activity plus engagement plus temporal features, and the complete feature set.

      The ROC-AUC increases from 0.5851 using activity fea- tures to 0.5983 after incorporating temporal features, while the complete feature set produces a ROC-AUC of 0.6005. This indicates that the addition of temporal information is associ- ated with an increase in ROC-AUC in the evaluated experi- ments. However, PR-AUC does not follow the same pattern and decreases from 0.0334 for the activity-plus-engagement conguration to 0.0296 and 0.0254 for the temporal and full-feature congurations, respectively. These results indicate that the contribution of temporal information differs across evaluation metrics.

    5. Threshold Sensitivity

      Figure 6 examines the sensitivity of the prediction task to the denition of future trending.

      As the required future-growth threshold increases from 25% to 100%, ROC-AUC decreases from 0.6077 to 0.5841, while

      Fig. 5. Effect of progressively adding feature groups on Random Forest per- formance. The experiments evaluate activity features, activity plus engagement features, activity plus engagement plus temporal features, and the complete feature set using ROC-AUC and PR-AUC.

      Fig. 6. Sensitivity of model performance to the future-growth threshold. Model performance is evaluated using ROC-AUC, PR-AUC, recall, and F1- score for future tweet-count growth thresholds of 25%, 50%, 75%, and 100%.

      PR-AUC decreases from 0.0263 to 0.0146. Recall and F1- score also decrease across the evaluated thresholds. The results indicate that larger future activity increases are progressively more difcult to identify under the evaluated experimental setup.

    6. Random Forest Feature Importance

      Figure 7 presents the feature importance values obtained from the Random Forest model.

      The feature importance analysis provides an additional inter- pretation of the Random Forest model beyond the aggregate evaluation metrics. The results show that the input features contribute at diffeent levels to the learned decision structure, providing insight into the relative contribution of activity, engagement, and temporal information.

    7. Discussion of Results

    The experimental results show that both Logistic Regres- sion and Random Forest provide comparable predictive per- formance for the future-trending classication task. Logistic Regression obtains a ROC-AUC of 0.6058 and a PR-AUC of 0.0276, while Random Forest obtains a ROC-AUC of 0.6005 and a PR-AUC of 0.0261. Differences are also observed in precision, recall, and F1-score.

    Fig. 7. Random Forest feature importance across the activity, engagement, temporal, and trend-related feature groups.

    The ablation analysis provides evidence that temporal infor- mation contributes to the prediction task. ROC-AUC increases from 0.5851 using activity features to 0.5983 after temporal features are added. The complete feature set produces a ROC- AUC of 0.6005. However, PR-AUC does not increase con- sistently with the addition of feature groups, highlighting the importance of evaluating the models using multiple metrics.

    The threshold sensitivity analysis further shows that predic- tion performance changes with the denition of future trend- ing. Increasing the required future tweet-count growth from 25% to 100% results in lower ROC-AUC, PR-AUC, recall, and F1-score. This indicates that larger short-term activity increases are more difcult to identify under the evaluated experimental setup.

    Overall, the experiments demonstrate the relevance of com- bining current activity, engagement, and temporal information for studying future hashtag activity. The results also highlight the difculty of the task due to the strong imbalance between trending and non-trending observations.

  6. Conclusion

This study developed a machine-learning approach for predicting future Twitter/X hashtag trends using temporal, activity, and engagement-based features. The problem was formulated as binary classication at the hashtag-hour level using a chronological 80:20 train-test split and class weighting. The nal dataset contains 4,654,390 hashtag-hour observa- tions. The feature set includes tweet activity, retweet statistics, unique users, growth rate, tweet velocity, tweet acceleration, engagement rate, and trend score. Logistic Regression and Random Forest were evaluated using ROC-AUC, PR-AUC,

precision, recall, and F1-score.

Logistic Regression obtained a ROC-AUC of 0.6058 and a PR-AUC of 0.0276, while Random Forest obtained a ROC- AUC of 0.6005 and a PR-AUC of 0.0261. The results show that the two models provide comparable performance, with differences across the individual evaluation metrics.

The feature ablation experiments indicate that adding tem- poral features is associated with an increase in ROC-AUC, from 0.5851 using activity features to 0.5983 after incorporat-

ing temporal information. The complete feature set produced a ROC-AUC of 0.6005. The threshold sensitivity analysis further showed that increasing the required future-growth threshold from 25% to 100% was associated with decreasing predictive performance across the evaluated metrics.

Overall, the study demonstrates a methodology for analysing future hashtag activity using activity, engagement, and temporal features while accounting for the highly im- balanced nature of the prediction task. Future work could investigate richer content-based features, sustained multi-hour trend denitions, and additional modelling approaches.

References

  1. E. Otsuka, S. A. Wallace, and D. Chiu, A hashtag recommendation system for Twitter data streams, Computational Social Networks, vol. 3, no. 1, p. 3, 2016.

    doi: https://doi.org/10.1186/s40649-016-0028-9.

  2. H. Lu and C. Lee, A Twitter hashtag recommendation model that accommodates temporal clustering effects, IEEE Intelligent Systems, vol. 30, no. 3, pp. 1825, 2015.

    doi: https://doi.org/10.1109/MIS.2015.20.

  3. R. Dovgopol and M. Nohelty, Twitter hash tag recommendation, arXiv preprint arXiv:1502.00094, 2015.

    Available: https://arxiv.org/abs/1502.00094.

  4. S. M. Kywe, T. A. Hoang, E. P. Lim, and F. Zhu, On recommending hashtags in Twitter networks, in Social Informatics, vol. 7710, 2012,

    pp. 337350.

    doi: https://doi.org/10.1007/978-3-642-35386-425.

  5. M. Efron, Hashtag retrieval in a microblogging environment, in Proc. 33rd Annual ACM SIGIR Conference on Research and Development in Information Retrieval, 2010, pp. 787788.

    doi: https://doi.org/10.1145/1835449.1835616.

  6. S. Kausar, B. Tahir, and M. A. Mehmood, Push-To-Trend: A novel framework to detect trend promoters in trending hashtags, IEEE Access, vol. 10, pp. 113005113017, 2022.

    doi: https://doi.org/10.1109/ACCESS.2022.3216891.

  7. B. Tahir and M. A. Mehmood, Anbar: Collection and analysis of a large scale Urdu language Twitter corpus, Journal of Intelligent & Fuzzy Systems, vol. 42, no. 5, pp. 47894800, 2022.

    doi: https://doi.org/10.3233/JIFS-219266.

  8. Z. Ma, A. Sun, and G. Cong, On predicting the popularity of newly emerging hashtags in Twitter, Journal of the Association for Information Science and Technology, vol. 64, no. 7, pp. 13991410, 2013.

    doi: https://doi.org/10.1002/asi.22844.

  9. T. Varma, B. Sharma, D. Vengurlekar, and L. Silveira, Real Time Sentiment Analysis of Twitter, International Journal of Engineering Science Invention (IJESI), vol. 9, no. 6, Series I, pp. 1322, Jun. 2020. doi: https://doi.org/10.35629/6734-0906011322.

  10. T. Varma, A. Keerimolel, B. Gowray, J. Limbachia, and K. Karekar, Brand Review Analysis Using Twitter Dataset, Journal of Engineering Sciences, vol. 11, no. 5, May 2020. ISSN 0377-9254.