WinstonLiyt
MCI-GRU
Python

The official code implementation for MCI-GRU: Stock Prediction Model Based on Multi-Head Cross-Attention and Improved GRU.

Last updated Jun 24, 2026
34
Stars
9
Forks
2
Issues
0
Stars/day
Attention Score
34
Language breakdown
No language data available.
โ–ธ Files click to expand
README

MCI-GRU: Stock Prediction Model Based on Multi-Head Cross-Attention and Improved GRU (Neurocomputing).

arXiv Python PyTorch License

๐Ÿ“– Overview

MCI-GRU is a stock forecasting architecture that replaces the GRU reset gate with an attention mechanism for dynamic temporal feature selection, incorporates a Graph Attention Network (GAT) to model inter-stock dependencies, and employs multi-head cross-attention to infer latent market states. By fusing temporal, cross-sectional, and latent representations, MCI-GRU achieves state-of-the-art performance on CSI 300/500, S&P 500, and NASDAQ 100 benchmarks, delivering higher ARR, Sharpe, and Calmar ratios, and has been deployed in live fund management systems.

image

๐Ÿ† Experiment Results

Performance Comparison

Performance Results

Ablation Study

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8 or higher
  • CUDA-compatible GPU (recommended for training)
  • 8GB+ RAM

Installation

  • Clone the repository
git clone https://github.com/WinstonLiyt/MCI-GRU.git
   cd MCI-GRU
  • Create and activate virtual environment
# Using conda
   conda create -n mcigru python=3.8
   conda activate mcigru
   
   # Or using venv
   python -m venv mcigru_env
   source mcigru_env/bin/activate  # Linux/Mac
   # or
   mcigru_env\Scripts\activate     # Windows
  • Install dependencies
pip install -r requirements.txt

Data Preparation

  • Prepare your dataset in CSV format with the following columns:
- kdcode: Stock code identifier - dt: Date (YYYY-MM-DD format) - close, open, high, low: OHLC prices - turnover: Trading turnover - volume: Trading volume
  • Update the data path in the script:
filename = '/path/to/your/dataset.csv'

Usage

Training and Prediction

Run the main training script for different market indices:

# CSI 300 Index
python code/csi300.py

Ablation Studies

Run ablation studies to analyze component contributions:

# Ablation studies for CSI 300 Index
python ablation/csi300.py

๐Ÿ“ Project Structure

MCI-GRU/
โ”œโ”€โ”€ code/                   # Main implementation
โ”‚   โ”œโ”€โ”€ csi300.py           # CSI 300 index model
โ”‚   โ”œโ”€โ”€ csi500.py           # CSI 500 index model
โ”‚   โ”œโ”€โ”€ sp500.py            # S&P 500 index model
โ”‚   โ””โ”€โ”€ nasdaq100.py        # NASDAQ 100 index model
โ”œโ”€โ”€ ablation/               # Ablation study implementations
โ”‚   โ”œโ”€โ”€ csi300.py           # CSI 300 ablation studies
โ”‚   โ”œโ”€โ”€ csi500.py           # CSI 500 ablation studies
โ”‚   โ”œโ”€โ”€ sp500.py            # S&P 500 ablation studies
โ”‚   โ””โ”€โ”€ nasdaq100.py        # NASDAQ 100 ablation studies
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ README.md               # This file
โ””โ”€โ”€ LICENSE                 # MIT License

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“š Citation

If you find this repository helpful, please cite our paper:

@article{zhu2025mci,
  title={MCI-GRU: Stock prediction model based on multi-head cross-attention and improved GRU},
  author={Zhu, Peng and Li, Yuante and Hu, Yifan and Xiang, Sheng and Liu, Qinyuan and Cheng, Dawei and Liang, Yuqi},
  journal={Neurocomputing},
  volume={638},
  pages={130168},
  year={2025},
  publisher={Elsevier}
}

Disclaimer: This code is for research purposes only. Past performance does not guarantee future results. Please conduct your own research before making investment decisions.

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท WinstonLiyt/MCI-GRU ยท Updated daily from GitHub