The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: DatasetGenerationCastError
Exception: DatasetGenerationCastError
Message: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 3 new columns ({'amount', 'open_interest', 'code'})
This happened while the csv dataset builder was generating data using
hf://datasets/AUSTINGINA/Forecasting/FinBert/中证100.csv (at revision efe30305c25c0ab9b924636ed415d5790ea44472)
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/builder.py", line 1831, in _prepare_split_single
writer.write_table(table)
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/arrow_writer.py", line 714, in write_table
pa_table = table_cast(pa_table, self._schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/table.py", line 2272, in table_cast
return cast_table_to_schema(table, schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/table.py", line 2218, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
Unnamed: 0: int64
time: string
code: string
open: double
high: double
low: double
close: double
volume: int64
amount: double
open_interest: double
-- schema metadata --
pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 1380
to
{'Unnamed: 0': Value('int64'), 'time': Value('string'), 'open': Value('float64'), 'high': Value('float64'), 'low': Value('float64'), 'close': Value('float64'), 'volume': Value('int64')}
because column names don't match
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1455, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1054, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/builder.py", line 894, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/builder.py", line 970, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/builder.py", line 1702, in _prepare_split
for job_id, done, content in self._prepare_split_single(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/.venv/lib/python3.12/site-packages/datasets/builder.py", line 1833, in _prepare_split_single
raise DatasetGenerationCastError.from_cast_error(
datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 3 new columns ({'amount', 'open_interest', 'code'})
This happened while the csv dataset builder was generating data using
hf://datasets/AUSTINGINA/Forecasting/FinBert/中证100.csv (at revision efe30305c25c0ab9b924636ed415d5790ea44472)
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
Unnamed: 0 int64 | time string | open float64 | high float64 | low float64 | close float64 | volume int64 |
|---|---|---|---|---|---|---|
1 | 2017/5/25 | 49.2425 | 49.950001 | 49.105499 | 49.668999 | 96,440,000 |
2 | 2017/5/26 | 49.75 | 49.932499 | 49.462502 | 49.789001 | 69,384,000 |
3 | 2017/5/30 | 49.8255 | 50.060001 | 49.776001 | 49.834999 | 65,262,000 |
4 | 2017/5/31 | 50 | 50.006001 | 49.108002 | 49.730999 | 78,262,000 |
5 | 2017/6/1 | 49.929501 | 49.949501 | 49.568501 | 49.797501 | 49,096,000 |
6 | 2017/6/2 | 49.949501 | 50.424 | 49.783501 | 50.336498 | 75,046,000 |
7 | 2017/6/5 | 50.3615 | 50.6605 | 50.175499 | 50.567001 | 54,398,000 |
8 | 2017/6/6 | 50.599998 | 50.825001 | 50.0625 | 50.150002 | 66,928,000 |
9 | 2017/6/7 | 50.297501 | 50.512501 | 50.099998 | 50.503502 | 56,460,000 |
10 | 2017/6/8 | 50.603001 | 50.6805 | 50.3055 | 50.5135 | 55,358,000 |
11 | 2017/6/9 | 50.625 | 50.649502 | 46.349998 | 48.915501 | 152,954,000 |
12 | 2017/6/12 | 48.349998 | 48.797501 | 47.25 | 48.245499 | 188,944,000 |
13 | 2017/6/13 | 48.899502 | 49.224998 | 48.305 | 49.039501 | 91,600,000 |
14 | 2017/6/14 | 49.429501 | 49.516998 | 48.335499 | 48.823502 | 79,498,000 |
15 | 2017/6/15 | 47.935001 | 48.286499 | 47.542999 | 48.2085 | 107,478,000 |
16 | 2017/6/16 | 49.799999 | 49.987499 | 49.099998 | 49.385502 | 229,454,000 |
17 | 2017/6/19 | 50.849998 | 50.849998 | 49.494999 | 49.758499 | 100,868,000 |
18 | 2017/6/20 | 49.900002 | 50.243999 | 49.601002 | 49.629501 | 81,536,000 |
19 | 2017/6/21 | 49.935001 | 50.136002 | 49.6325 | 50.1115 | 58,450,000 |
20 | 2017/6/22 | 50.1115 | 50.348 | 49.860001 | 50.064999 | 45,068,000 |
21 | 2017/6/23 | 50.126999 | 50.230999 | 49.901001 | 50.187 | 57,582,000 |
22 | 2017/6/26 | 50.424999 | 50.490002 | 49.599998 | 49.699001 | 67,724,000 |
23 | 2017/6/27 | 49.5345 | 49.939999 | 48.799999 | 48.839001 | 75,648,000 |
24 | 2017/6/28 | 48.927502 | 49.534 | 48.460499 | 49.516499 | 74,752,000 |
25 | 2017/6/29 | 48.950001 | 49.377998 | 48.262501 | 48.796501 | 86,060,000 |
26 | 2017/6/30 | 49.006001 | 49.1735 | 48.380501 | 48.400002 | 67,806,000 |
27 | 2017/7/3 | 48.6395 | 48.724499 | 47.549999 | 47.682999 | 58,182,000 |
28 | 2017/7/5 | 48.0765 | 48.75 | 47.762501 | 48.57 | 73,060,000 |
29 | 2017/7/6 | 48.233002 | 48.720001 | 47.951 | 48.257 | 65,192,000 |
30 | 2017/7/7 | 48.477501 | 49.005501 | 48.457001 | 48.938 | 52,868,000 |
31 | 2017/7/10 | 49.25 | 49.972 | 49.174999 | 49.823502 | 70,926,000 |
32 | 2017/7/11 | 49.650002 | 49.7995 | 49.186001 | 49.706501 | 59,654,000 |
33 | 2017/7/12 | 50.032501 | 50.427502 | 49.904999 | 50.3255 | 72,172,000 |
34 | 2017/7/13 | 50.230999 | 50.344002 | 49.794998 | 50.031502 | 57,616,000 |
35 | 2017/7/14 | 50.119999 | 50.2225 | 49.844501 | 50.0905 | 42,050,000 |
36 | 2017/7/17 | 50.234501 | 50.737499 | 50.190498 | 50.501999 | 74,252,000 |
37 | 2017/7/18 | 50.299999 | 51.301498 | 50.200001 | 51.2225 | 80,152,000 |
38 | 2017/7/19 | 51.25 | 51.579498 | 51.125 | 51.343498 | 59,280,000 |
39 | 2017/7/20 | 51.579498 | 51.748501 | 51.125999 | 51.435001 | 61,950,000 |
40 | 2017/7/21 | 51.063999 | 51.305 | 50.549999 | 51.283501 | 54,692,000 |
41 | 2017/7/24 | 51.417 | 52.150501 | 51.371498 | 51.947498 | 65,760,000 |
42 | 2017/7/25 | 51.9025 | 52.1665 | 51.624001 | 51.9935 | 48,952,000 |
43 | 2017/7/26 | 52.16 | 52.66 | 52.16 | 52.639999 | 58,426,000 |
44 | 2017/7/27 | 53.477501 | 54.165501 | 52.008999 | 52.299999 | 219,834,000 |
45 | 2017/7/28 | 50.606998 | 51.642502 | 50.049999 | 51.001999 | 154,188,000 |
46 | 2017/7/31 | 50.952499 | 50.952499 | 49.351002 | 49.389 | 147,042,000 |
47 | 2017/8/1 | 49.8055 | 50.32 | 49.578999 | 49.809502 | 91,452,000 |
48 | 2017/8/2 | 50.088501 | 50.1605 | 49.086498 | 49.794498 | 81,400,000 |
49 | 2017/8/3 | 49.973499 | 49.974998 | 49.2295 | 49.346001 | 65,116,000 |
50 | 2017/8/4 | 49.484001 | 49.5835 | 49.099998 | 49.379002 | 54,606,000 |
51 | 2017/8/7 | 49.532501 | 49.75 | 49.356998 | 49.613499 | 53,532,000 |
52 | 2017/8/8 | 49.717499 | 49.813999 | 49.289501 | 49.492001 | 58,056,000 |
53 | 2017/8/9 | 49.130001 | 49.400002 | 48.7635 | 49.100498 | 71,394,000 |
54 | 2017/8/10 | 48.814999 | 48.993 | 47.734001 | 47.846001 | 113,682,000 |
55 | 2017/8/11 | 48 | 48.519501 | 47.569 | 48.399502 | 69,360,000 |
56 | 2017/8/14 | 48.920502 | 49.275002 | 48.809502 | 49.165001 | 63,458,000 |
57 | 2017/8/15 | 49.445 | 49.587002 | 49.099998 | 49.137001 | 50,986,000 |
58 | 2017/8/16 | 49.0825 | 49.323002 | 48.660999 | 48.909 | 62,642,000 |
59 | 2017/8/17 | 48.891998 | 48.891998 | 48.015999 | 48.0285 | 70,248,000 |
60 | 2017/8/18 | 48.07 | 48.2715 | 47.732498 | 47.9235 | 65,696,000 |
61 | 2017/8/21 | 47.878502 | 48.060001 | 47.272999 | 47.664501 | 63,290,000 |
62 | 2017/8/22 | 47.776001 | 48.3965 | 47.775002 | 48.345001 | 55,000,000 |
63 | 2017/8/23 | 47.969002 | 48.099998 | 47.709999 | 47.900002 | 53,366,000 |
64 | 2017/8/24 | 47.870998 | 47.950001 | 47.056999 | 47.622501 | 103,914,000 |
65 | 2017/8/25 | 47.799999 | 47.881001 | 47.205002 | 47.263 | 66,496,000 |
66 | 2017/8/28 | 47.327 | 47.650002 | 47.112499 | 47.300999 | 51,934,000 |
67 | 2017/8/29 | 47 | 47.799999 | 46.816502 | 47.702999 | 57,486,000 |
68 | 2017/8/30 | 47.922001 | 48.470501 | 47.845501 | 48.379501 | 58,092,000 |
69 | 2017/8/31 | 48.735001 | 49.049999 | 48.638 | 49.029999 | 66,630,000 |
70 | 2017/9/1 | 49.209999 | 49.224998 | 48.844002 | 48.912498 | 50,718,000 |
71 | 2017/9/5 | 48.77 | 48.838501 | 48.018501 | 48.2635 | 57,664,000 |
72 | 2017/9/6 | 48.416 | 48.591999 | 48.029999 | 48.389999 | 42,598,000 |
73 | 2017/9/7 | 48.700001 | 49.029499 | 48.627499 | 48.973499 | 51,336,000 |
74 | 2017/9/8 | 48.955002 | 48.993999 | 48.1735 | 48.294998 | 52,106,000 |
75 | 2017/9/11 | 48.723 | 49.097 | 48.710999 | 48.897999 | 43,734,000 |
76 | 2017/9/12 | 49.163502 | 49.233501 | 48.776001 | 49.129002 | 49,622,000 |
77 | 2017/9/13 | 49.198502 | 50 | 48.971001 | 49.98 | 67,494,000 |
78 | 2017/9/14 | 49.84 | 49.928001 | 49.387001 | 49.6105 | 78,266,000 |
79 | 2017/9/15 | 49.650501 | 49.8125 | 49.2015 | 49.3395 | 75,204,000 |
80 | 2017/9/18 | 49.52 | 49.6395 | 48.408501 | 48.709499 | 68,226,000 |
81 | 2017/9/19 | 48.862499 | 48.911999 | 48.373001 | 48.493 | 53,422,000 |
82 | 2017/9/20 | 48.5895 | 48.740501 | 48.108002 | 48.6605 | 57,776,000 |
83 | 2017/9/21 | 48.565498 | 48.584999 | 48.101002 | 48.232498 | 46,752,000 |
84 | 2017/9/22 | 48.050499 | 48.280499 | 47.721001 | 47.755001 | 52,836,000 |
85 | 2017/9/25 | 47.4655 | 47.471001 | 46.644501 | 46.989498 | 102,480,000 |
86 | 2017/9/26 | 47.274502 | 47.431499 | 46.587502 | 46.93 | 71,296,000 |
87 | 2017/9/27 | 47.400002 | 47.764999 | 47.165001 | 47.543499 | 62,978,000 |
88 | 2017/9/28 | 47.592999 | 47.985001 | 47.505001 | 47.82 | 50,452,000 |
89 | 2017/9/29 | 48.005501 | 48.241501 | 47.918999 | 48.067501 | 50,876,000 |
90 | 2017/10/2 | 48.200001 | 48.365501 | 47.605999 | 47.959499 | 48,858,000 |
91 | 2017/10/3 | 47.900002 | 48.184502 | 47.518501 | 47.855 | 53,332,000 |
92 | 2017/10/4 | 47.710499 | 48.3895 | 47.702499 | 48.272499 | 50,548,000 |
93 | 2017/10/5 | 48.5 | 49.0755 | 48.481998 | 49.0425 | 64,584,000 |
94 | 2017/10/6 | 48.782001 | 49.787498 | 48.782001 | 49.479 | 75,642,000 |
95 | 2017/10/9 | 49.661999 | 49.924999 | 49.375 | 49.5495 | 58,772,000 |
96 | 2017/10/10 | 49.8335 | 49.897499 | 49.005001 | 49.360001 | 61,698,000 |
97 | 2017/10/11 | 49.563499 | 49.775002 | 49.334999 | 49.75 | 46,742,000 |
98 | 2017/10/12 | 49.8405 | 50.422001 | 49.619999 | 50.046501 | 81,346,000 |
99 | 2017/10/13 | 50.349998 | 50.3885 | 50.051498 | 50.146999 | 48,630,000 |
100 | 2017/10/16 | 50.422001 | 50.4785 | 50.051998 | 50.317001 | 40,178,000 |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Austin.S---Forecasting
Forecasting
Adaptive Transformer–RL Framework for Sentiment-Driven Financial Forecasting
Overview
This repository contains the official implementation of the hybrid framework proposed in our MDPI Forecasting 2025 paper:
"From Market Volatility to Predictive Insight: An Adaptive Transformer–RL Framework for Sentiment-Driven Financial Time-Series Forecasting"
URL:https://www.mdpi.com/2571-9394/7/4/55
The framework integrates domain-specific sentiment analysis, heterogeneous prediction models (SVR + Transformer variants), and Deep Q-Network (DQN)-driven dynamic ensembling to address the challenges of financial time-series forecasting (e.g., market volatility, nonlinear regimes, and sentiment-quant data fusion).
Paper Abstract
Financial time-series prediction remains challenging due to market volatility, nonlinear dynamics, and the complex interplay between quantitative indicators and investor sentiment. Traditional models (e.g., ARIMA, GARCH) fail to capture textual sentiment, while static deep learning methods cannot adapt to market regime shifts (bull/bear/consolidation).
Our proposed framework:
- Constructs a domain-specific financial sentiment dictionary (16,673 entries) with up to 97.35% forum title classification accuracy.
- Fuses historical price data and investor sentiment into a hybrid model stack (SVR + 3 Transformer variants).
- Uses a DQN agent to dynamically ensemble predictions, adapting to real-time market conditions.
Experiments on diverse assets (China Unicom, CSI 100, Corn Futures, Amazon) show the framework outperforms benchmark and state-of-the-art models, achieving the lowest RMSE across volatile and stable markets.
Key Contributions
- Domain-Specific Sentiment Dictionary: Built via SnowNLP and Word2Vec, tailored for financial investor forums (16,673 entries, 97.35% classification accuracy).
- Heterogeneous Model Stack: Combines SVR (linear trends) with 3 Transformer variants (nonlinear dependencies):
- Base-Transformer (single-layer encoder for moderate markets)
- Multi-Transformer (3-layer encoder for volatile markets)
- Bi-Transformer (bidirectional encoder for contextual feature extraction)
- DQN-Driven Dynamic Ensembling: Adaptively weights model outputs based on market volatility (reward = -MSE), outperforming static ensembles (arithmetic mean, weighted average).
- Multi-Market Generalization: Validated on equities, indices, and commodities (RMB/USD-denominated assets) across global events (Russia–Ukraine war, COVID-19).
Repository Structure
仓库结构
.
├── data/ # 数据处理脚本和样本数据
│ ├── raw/ # 原始数据(金融价格 + 论坛文本)
│ ├── processed/ # 预处理数据(归一化价格 + 情感分数)
│ ├── dictionary/ # 金融情感词典(16k 条目)
│ └── data_loader.py # 数据加载和预处理管道
├── models/ # 核心模型实现
│ ├── sentiment/ # 情感分析(SnowNLP + Word2Vec)
│ ├── predictors/ # 基础预测模型(SVR + Transformer 变体)
│ │ ├── svr.py
│ │ ├── base_transformer.py
│ │ ├── multi_transformer.py
│ │ └── bi_transformer.py
│ └── dqn_ensemble.py # 基于 DQN 的动态集成
├── experiments/ # 实验脚本
│ ├── train.py # 模型训练管道
│ ├── evaluate.py # 评估(RMSE/MAE/MAPE)
│ └── visualize.py # 结果可视化(时间序列图、SHAP 分析)
├── utils/ # 辅助函数
│ ├── metrics.py # 评估指标(MSE, RMSE, MAE, MAPE)
│ └── preprocessing.py # 文本清洗(正则、停用词移除、结巴分词)
├── requirements.txt # 依赖项
├── LICENSE # MIT 许可证
└── README.md # 项目文档
- Downloads last month
- 6