Keshav Sundararaman

Case study

Abnormal Move Prediction in S&P 500 Stocks

Will a stock make an abnormal move tomorrow? A binary classifier over 5 years of daily price and volume data for 505 S&P 500 stocks, built for CSE 5367 (Pattern Recognition) at UT Arlington.

Test AUC (Random Forest)
0.723
Test F1 at a 2% threshold
0.307
Daily OHLCV rows
619,040
No-lookahead features
12

How it works

  1. 1

    Load

    619,040 daily OHLCV rows for 505 stocks, 2013–2018

  2. 2

    Engineer features

    12 per stock-day (returns, volatility, price range, gap, true range), past data only

  3. 3

    Label

    Next-day return beyond 2% or 1.5% in either direction

  4. 4

    Split by time

    Train, validation and test in date order, no shuffling

  5. 5

    Train and tune

    Five models, hyperparameters chosen on validation F1

  6. 6

    Evaluate

    All models scored on the same held-out test period

Results

Test set at the 2% threshold (12,455 abnormal and 106,397 normal stock-days)
ModelTest F1AUCPrecisionRecall
Logistic regression, L10.3030.7160.2260.460
Logistic regression, L20.3030.7160.2260.456
Linear SVM0.3000.7150.2290.435
Random Forest0.3070.7230.2210.502
Logistic regression, L2 + PCA0.3010.7150.2260.451

What I found

  • Random Forest was best at both thresholds, which suggests nonlinear feature interactions matter.
  • L1 and L2 regularization gave nearly identical results. L1 zeroed 2 of the 12 features without hurting performance, so those carried little independent signal.
  • PCA at 95% variance cut 12 features to 9 components and slightly hurt performance: the dropped components held a small amount of real signal.
  • Volatility and price-range features were consistently the strongest predictors.

Limitations

  • Validation F1 was higher than test F1 for every model. The test year (2017) was a calmer market than the validation year (2016), which is a real cost of a time-based split.
  • All stochastic steps use a fixed random seed, so the numbers above reproduce from the repo.

Figures

ROC curves for the five models at the 2% threshold
ROC curves at the 2% threshold.
Random Forest feature importances at the 2% threshold
Feature importances at the 2% threshold.

Built with

PythonPandasNumPyScikit-learnTime-Series ValidationFeature Engineering