# WanTsai **Repository Path**: naza/wan-tsai ## Basic Information - **Project Name**: WanTsai - **Description**: 基于大模型的股票预测 - **Primary Language**: Python - **License**: GPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2024-04-26 - **Last Updated**: 2025-04-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # WanTsai(旺财)股票预测 WanTsai(旺财)是基于深度时间序列分析进行股票预测的开源项目。基于TSlib项目开发。 ## 包含的模型. - [x] **iTransformer** - iTransformer: Inverted Transformers Are Effective for Time Series Forecasting [[arXiv 2023]](https://arxiv.org/abs/2310.06625) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/iTransformer.py). - [x] **TimesNet** - TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis [[ICLR 2023]](https://openreview.net/pdf?id=ju_Uqw384Oq) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/TimesNet.py). - [x] **Transformer** - Attention is All You Need [[NeurIPS 2017]](https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Transformer.py). ## 用法 1. 安装Python 3.8和pytorch-cuda. 并执行以下命令安装依赖包. 建议通过 [Conda](https://docs.conda.io/en/latest/) 进行环境管理。 执行以下命令新建一个 conda 环境并安装所需依赖: winddows下要注意使用管理员身份运行anconda提供的shell ```bash conda create -n WanTsai python=3.8 conda activate WanTsai pip install -r requirements.txt ``` 在中国可以使用清华镜像加速安装依赖包 ```bash pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt ``` 删除环境 ```bash conda deactivate conda env remove --name WanTsai ``` 安装pytorch-cuda:从https://pytorch.org/安装12.1版本 2. 将数据集下载到`./dataset`文件夹下。 3. 最佳实践参数: * d_ff取d_model的一半可以提升准确率 * 股票预测 ``` python -u run.py \ --task_name long_term_forecast \ --is_training 1 \ --root_path ./dataset/featured/ \ --data_path week \ --model_id stock_ror \ --model $model_name \ --data multi \ --features MS \ --target ror \ --seq_len 12 \ --label_len 4 \ --pred_len 1 \ --e_layers 3 \ --d_layers 1 \ --factor 3 \ --enc_in 8 \ --dec_in 8 \ --c_out 1 \ --des 'Base_ROR_IDXROR' \ --d_model 512\ --d_ff 256\ --itr 1 \ --freq w \ --inverse \ ``` * 指数预测 ``` python -u run.py \ --task_name long_term_forecast \ --is_training 1 \ --root_path ./dataset/featured/week/ \ --data_path idx \ --model_id idx_ror \ --model $model_name \ --data multi \ --features MS \ --target ror \ --seq_len 12 \ --label_len 1 \ --pred_len 1 \ --e_layers 3 \ --d_layers 1 \ --factor 3 \ --enc_in 7 \ --dec_in 7 \ --c_out 1 \ --des 'Base_ROR' \ --d_model 128\ --d_ff 64\ --itr 1 \ --freq w \ --train_epochs 15 \ --inverse \ ```