Spatial-temporal attention-based convolutional network with text and numerical information for stock price prediction

Chin-Teng Lin, Yu-Kai Wang, Pei-Lun Huang, Ye Shi, Yu-Cheng ChangNeural Computing and Applications 2022

Abstract

Stock price prediction is a complex task due to the influence of both quantitative historical data and qualitative external news. This paper presents the Spatial-Temporal Attention-based Convolutional Network (STACN), a multi-modal fusion model that integrates numerical stock indicators with daily news headlines. By employing a spatial-temporal attention mechanism, the model dynamically weights news features based on temporal price trends, effectively filtering noise and improving prediction accuracy.

Introduction

Predicting stock market movements is notoriously difficult as prices are influenced by a chaotic mix of quantitative factors and qualitative events. Traditional deep learning models often suffer from two main limitations: data silos, where they rely solely on numerical data, and lossy text processing, where semantic relationships between news and price movements are discarded. The STACN architecture bridges this gap by treating news as a spatial feature map that is dynamically weighted by temporal trends found in numerical data.

Methodology

The STACN architecture consists of four primary components designed to fuse disparate data types into a single predictive output.

Overview of the STACN architecture, illustrating the fusion of CNN-based text features and LSTM-based numerical features via the STAN module.

Text Preprocessing and CNN

Instead of simple word counts, the model utilizes a Sequence-to-Sequence (Seq2Seq) autoencoder built with LSTMs to convert news titles into "thought vectors." These vectors are organized into 2D maps and processed by a Convolutional Neural Network (CNN) to extract spatial features, identifying semantic patterns across the top 25 daily headlines.

Seq2Seq decoder for generating thought vectors from news headlines.

Numerical Processing and Attention

A separate Long Short-Term Memory (LSTM) branch processes 10 days of historical numerical data (Open, High, Low, Close, Volume, and Adjusted Close) to capture temporal trends. The core innovation is the Spatial-Temporal Attention Network (STAN), which uses the hidden states from the LSTM to calculate attention weights for the CNN’s feature maps. This mechanism allows the model to prioritize specific news features that are most relevant to the current price trend.

Fusion and Prediction

A final fully connected layer merges the weighted text features and the numerical features to produce the final price prediction.

Data and Experimental Setup

The model was evaluated using data from August 2008 to July 2016:

  • Numerical Data: Historical indicators for the Dow Jones Industrial Average (DJIA) from Yahoo Finance.
  • Text Data: Top 25 daily news headlines from Reddit WorldNews, ranked by user upvotes. The dataset comprised 1,980 samples, with 1,200 used for training and 780 for testing.

Results and Discussion

The STACN was compared against several baselines using Mean Squared Error (MSE) and Correlation Coefficient ($r$).

Model MSE Correlation ($r$)
CNN (News only) 28.3935 -
CNN (Stocks only) 0.1814 -
LSTM (Stocks only) 0.0763 -
STACN (Proposed) 0.0304 0.9847

The results demonstrate that news titles alone are poor predictors due to high noise levels. However, when filtered through the STAN module, news becomes a powerful predictive signal. Removing the attention mechanism (STACN without Attention) caused the MSE to rise to 0.082, confirming that the attention network is critical for filtering irrelevant information. This highlights the synergistic relationship between numerical and textual data in financial forecasting.

Conclusion

The STACN model proves that the fusion of numerical and textual data, mediated by a spatial-temporal attention mechanism, significantly outperforms standalone models. While successful, the model is currently limited to news headlines and a specific index (DJIA). Future work may involve incorporating full-text articles or social media sentiment to provide deeper context, as well as testing the model's generalizability across different sectors. Additionally, the researchers are interested in extending this spatial-temporal attention approach to other fields like speech processing and physiological signal analysis.

Summary updated

BibTeX
@article{lin2022spatial,
  author = {Chin-Teng Lin and Yu-Kai Wang and Pei-Lun Huang and Ye Shi and Yu-Cheng Chang},
  title = {{Spatial-temporal attention-based convolutional network with text and numerical information for stock price prediction}},
  journal = {Neural Computing and Applications},
  year = {2022},
  doi = {10.1007/s00521-022-07234-0},
}
Figure