CNN-Trans-SPP: A small Transformer with CNN for stock price prediction

Understanding the patterns of financial activities and predicting their evolution and changes has always been a significant challenge in the field of behavioral finance. Stock price prediction is particularly difficult due to the inherent complexity and stochastic nature of the stock market. Deep le...

Full description

Saved in:
Bibliographic Details
Main Authors: Ying Li, Xiangrong Wang, Yanhui Guo
Format: Article
Language:English
Published: AIMS Press 2024-12-01
Series:Electronic Research Archive
Subjects:
Online Access:https://www.aimspress.com/article/doi/10.3934/era.2024314
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1832590732907511808
author Ying Li
Xiangrong Wang
Yanhui Guo
author_facet Ying Li
Xiangrong Wang
Yanhui Guo
author_sort Ying Li
collection DOAJ
description Understanding the patterns of financial activities and predicting their evolution and changes has always been a significant challenge in the field of behavioral finance. Stock price prediction is particularly difficult due to the inherent complexity and stochastic nature of the stock market. Deep learning models offer a more robust solution to nonlinear problems compared to traditional algorithms. In this paper, we propose a simple yet effective fusion model that leverages the strengths of both transformers and convolutional neural networks (CNNs). The CNN component is employed to extract local features, while the Transformer component captures temporal dependencies. To validate the effectiveness of the proposed approach, we conducted experiments on four stocks representing different sectors, including finance, technology, industry, and agriculture. We performed both single-step and multi-step predictions. The experimental results demonstrate that our method significantly improves prediction accuracy, reducing error rates by 45%, 32%, and 36.8% compared to long short-term memory(LSTM), attention-based LSTM, and transformer models.
format Article
id doaj-art-2f0bac0f9fe1415db6776823c63f3e50
institution Kabale University
issn 2688-1594
language English
publishDate 2024-12-01
publisher AIMS Press
record_format Article
series Electronic Research Archive
spelling doaj-art-2f0bac0f9fe1415db6776823c63f3e502025-01-23T07:53:06ZengAIMS PressElectronic Research Archive2688-15942024-12-0132126717673210.3934/era.2024314CNN-Trans-SPP: A small Transformer with CNN for stock price predictionYing Li0Xiangrong Wang1Yanhui Guo2College of Mathematics and Systems Science, Shandong University of Science and Technology, Qingdao 266590, ChinaCollege of Mathematics and Systems Science, Shandong University of Science and Technology, Qingdao 266590, ChinaSchool of Data and Computer Science, Shandong Women's University, Jinan 250300, ChinaUnderstanding the patterns of financial activities and predicting their evolution and changes has always been a significant challenge in the field of behavioral finance. Stock price prediction is particularly difficult due to the inherent complexity and stochastic nature of the stock market. Deep learning models offer a more robust solution to nonlinear problems compared to traditional algorithms. In this paper, we propose a simple yet effective fusion model that leverages the strengths of both transformers and convolutional neural networks (CNNs). The CNN component is employed to extract local features, while the Transformer component captures temporal dependencies. To validate the effectiveness of the proposed approach, we conducted experiments on four stocks representing different sectors, including finance, technology, industry, and agriculture. We performed both single-step and multi-step predictions. The experimental results demonstrate that our method significantly improves prediction accuracy, reducing error rates by 45%, 32%, and 36.8% compared to long short-term memory(LSTM), attention-based LSTM, and transformer models.https://www.aimspress.com/article/doi/10.3934/era.2024314stock price predictiontransformercnnlstm
spellingShingle Ying Li
Xiangrong Wang
Yanhui Guo
CNN-Trans-SPP: A small Transformer with CNN for stock price prediction
Electronic Research Archive
stock price prediction
transformer
cnn
lstm
title CNN-Trans-SPP: A small Transformer with CNN for stock price prediction
title_full CNN-Trans-SPP: A small Transformer with CNN for stock price prediction
title_fullStr CNN-Trans-SPP: A small Transformer with CNN for stock price prediction
title_full_unstemmed CNN-Trans-SPP: A small Transformer with CNN for stock price prediction
title_short CNN-Trans-SPP: A small Transformer with CNN for stock price prediction
title_sort cnn trans spp a small transformer with cnn for stock price prediction
topic stock price prediction
transformer
cnn
lstm
url https://www.aimspress.com/article/doi/10.3934/era.2024314
work_keys_str_mv AT yingli cnntranssppasmalltransformerwithcnnforstockpriceprediction
AT xiangrongwang cnntranssppasmalltransformerwithcnnforstockpriceprediction
AT yanhuiguo cnntranssppasmalltransformerwithcnnforstockpriceprediction