SEK·All projects ↗

2026 / data · quant

Financial Social-Media Anomaly Detection

Finding unusual language around the GameStop event.

BERTweet representations and unsupervised learning applied to StockTwits activity around GME in early 2021.

  • Python
  • PyTorch
  • BERTweet
  • PCA
  • Isolation Forest

01 / PROBLEM STATEMENT

Why this work exists

Market discussion is noisy, high-dimensional, and weakly labelled. This case study investigates unusual StockTwits language and activity around the GameStop event without presenting anomalies as trading signals.

Data and source material

  • Up to 100 GME posts from a Kaggle dataset with StockTwits API fallback
  • GME prices from Yahoo Finance for January–February 2021
  • Text plus sentiment, extreme-term, length, and posting-hour metadata

02 / SOLUTION OVERVIEW

From input to usable output

Normalize text, combine 768D embeddings with metadata, reduce dimensions and score anomalies.

  1. 01

    Normalize financial social text

  2. 02

    Generate 768-dimensional BERTweet embeddings

  3. 03

    Append four metadata signals into a 772-dimensional representation

  4. 04

    Reduce to 50 principal components

  5. 05

    Score posts with Isolation Forest and aggregate daily diagnostics

03 / TECHNICAL ARCHITECTURE

Implemented components

Documented component map
01

Messages + prices → preprocessing → 772D representation → PCA(50) → anomalies

Diagram synthesized from the pinned repository documentation; it is explanatory, not a runtime topology capture.

04 / METHODOLOGY & IMPLEMENTATION

Decisions that shape the system

  • The first-token hidden state from vinai/bertweet-base supplies contextual embeddings.
  • PCA reduces the combined representation before Isolation Forest scoring.
  • The entry point uses 200 trees and 0.1 contamination; the notebook uses 0.05, exposing sensitivity to that assumption.
  • Four selected GameStop dates provide a heuristic comparison rather than true labels.

Implemented capabilities

  • Kaggle/API fallback
  • Financial-text normalization
  • BERTweet embeddings
  • PCA + Isolation Forest
  • Daily diagnostics

05 / RESULTS & EVIDENCE

What the source supports

  • The repository provides a reproducible six-stage GME investigation and daily anomaly visualizations.
  • No causal, predictive, or trading-performance result is claimed.

Results preserve the repository’s units, evaluation framing, and stated limitations. Missing evidence is not converted into a claim.

06 / CHALLENGES & LIMITATIONS

Where the evidence stops

  • Four hand-selected dates are not a rigorously labelled anomaly dataset.
  • The executable case study is fixed to GME and a small 100-post run.
  • Contamination sets the expected anomaly share; outliers do not establish causality or forecast returns.

07 / WHAT THIS DEMONSTRATES

Engineering signal

Transformer inference, mixed text/metadata representations, dimensionality reduction, unsupervised detection, and explicit separation between anomaly and prediction.

08 / SOURCE & RELATED WORK

Trace the evidence

RepositoryStockTwits ↗
Audited files

README.md · notebooks/anomaly_detection.ipynb · src/