Machine Learning Models

Predicting engagement and uncovering structure in AI discussions on Reddit

Three tasks: controversial comment detection, comment count prediction, and unsupervised topic groups

Executive Summary

This page shows how simple machine learning models can read text and give useful signals about AI conversations. We look at three questions.

Logistic regression is able to separate controversial and non controversial comments with an area under the ROC curve close to 0.69. Gradient boosted trees that use both metadata and text embeddings predict comment counts with an RMSE around 0.57 on the log scale. Unsupervised clustering shows that most posts share a common vocabulary about general AI use, while a few very specific patterns form tiny separate clusters.

Main takeaway. Simple models already give stable signals about engagement and controversy. Text features add clear value on top of basic metadata, but the community still behaves in a very mixed way so predictions are far from perfect.

Task 1. Controversial Comment Classification

The first task predicts whether a long comment is marked as controversial. We focus on comments with more than 200 characters from seven AI related subreddits. The label comes from the Reddit field controversiality.

Model design

We balance the data to keep about one controversial comment for three non controversial ones. The model uses basic text features and simple numeric signals.

Table 1. Summary metrics on the test set
Model AUC ROC AUC PR Accuracy F1 score
Logistic regression 0.694 0.406 0.614 0.639
Random forest 0.672 0.394 0.445 0.440
Figure 1. Model comparison
AUC and F1 comparison for logistic regression and random forest
Figure 2. ROC curves
ROC curve comparison for logistic regression and random forest
Figure 3. Confusion matrix for logistic regression
Confusion matrix for logistic regression

Key insights

  • Logistic regression gives the best balance between recall and precision. It correctly classifies about sixty three percent of controversial comments while keeping false positive errors at a moderate level.
  • The random forest model is more aggressive. It catches more controversial comments but labels many neutral comments as controversial, which lowers accuracy and F1 score.
  • The ROC curves show that both models are clearly better than random guessing, but gains beyond logistic regression are small. This suggests that deeper non linear structure is limited at this level of features.

Task 2. Predicting Comment Counts

The second task predicts how many comments a submission will receive. This is a proxy for community engagement or attention.

Model design

The target variable is the natural log of one plus the comment count. This reduces the effect of rare very large threads and makes the distribution closer to normal.

Table 2. Best GBT performance on the log scale
Feature set Best maxIter RMSE test MAE test R squared test
Metadata plus TF IDF 30 0.601 0.325 0.673
Metadata plus Word2Vec 30 0.574 0.313 0.696
Figure 4. Learning curve for metadata plus TF IDF
Learning curve for GBT regression with metadata and TF IDF
Figure 5. Learning curve for metadata plus Word2Vec
Learning curve for GBT regression with metadata and Word2Vec
Figure 6. True versus predicted comment counts
Scatter plot of true versus predicted log comment counts

Key insights

  • Word2Vec embeddings clearly improve performance. They lower test RMSE from about 0.60 to 0.57 and raise the R squared value from about 0.67 to about 0.70.
  • Both learning curves show a gentle gap between train and test error. This suggests some overfitting but not a severe one. More trees bring slow but steady gains.
  • The scatter plot shows that the model captures the broad trend in log comment counts but still underestimates the most popular threads. Extreme viral posts remain hard to predict with these features.

Task 3. Unsupervised Topic Clustering

This task explores whether simple clustering can reveal meaningful structure in AI-related submissions. We apply KMeans to TF-IDF features from the title and selftext fields.

Method

Figure 7. Elbow curve for KMeans
Elbow curve for KMeans topic clustering

Representative clusters

Most submissions fall into a single broad cluster focused on general AI usage. A few very small clusters reflect highly specific and repeated patterns. Below are three representative clusters that illustrate the range of themes.

Cluster A: General AI Discussion

Top words:

  • ai
  • chatgpt
  • model
  • data
  • use

This cluster contains nearly all submissions and reflects broad conversations about how people use AI tools and models.

Cluster B: Plugin and Tool Templates

Top words:

  • plugin
  • search
  • find
  • data
  • ask

This tiny cluster captures a repeated plugin announcement or template. It is not a broad theme but shows how boilerplate content forms its own pattern.

Cluster C: Academic / Learning Posts

Top words:

  • start
  • students
  • learning
  • appreciate
  • questions

This cluster reflects an academic or classroom-focused message. Though small, it highlights a positive and learning-oriented tone.

Key insights

  • The elbow curve shows only a few major directions of variation, suggesting limited natural clustering structure.
  • One large cluster dominates, indicating that most posts use common vocabulary about AI and ChatGPT.
  • Very small clusters often come from repeated patterns or copied templates rather than distinct conversational themes.
  • Richer models or narrower subsets of posts would be needed to uncover more interpretable topics.

Technical Notes

All models run on a Spark cluster. Data is read from S3, processed in Spark DataFrames and stored again as Parquet, CSV and PNG plots.

The corresponding Python files live under code/ml/ and write metrics to data/csv/ and figures to data/plots/.