Initial commit: BTC 1h prediction model (53.10% accuracy)

🎯 项目成果:
- 准确率: 53.10% (2026年测试集)
- 任务类型: 二分类 (预测涨/跌)
- 特征: OHLCV + RSI + MACD (9个特征)
- 训练数据: 2020-2025年BTC小时数据 (52,351序列)
- 测试数据: 2026年1-29日 (484序列)

📊 性能指标:
- 精确率: 51.79%
- 召回率: 49.36%
- F1分数: 0.5054
- 预测分布: 非常平衡 (偏差仅-11个)

🔬 实验历史:
- 尝试了5种方案 (回归/分类, 不同数据划分)
- 分类任务优于回归任务 (53.10% vs 49.5%)
- 全量训练避免了过拟合问题

📦 主要模型文件:
- models/checkpoints/dlinear_classification_2026/
  - best_model.pt (最佳模型)
  - preprocessor.pkl (预处理器)
  - test_2026_results.json (测试结果)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
crypto_predictorandClaude Sonnet 4.5 committed 2026-01-29 21:27:15 +08:00
commit 9bbdc8d42b
82 files changed
+8742

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
Traceback (most recent call last):
File "/Users/xxz/miniforge3/envs/crypto_pred_312/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3641, in get_loc
return self._engine.get_loc(casted_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pandas/_libs/index.pyx", line 168, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 197, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7668, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7676, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'BBU_20_2.0'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/xxz/PycharmProjects/crypto_predictor/train_dlinear_real.py", line 163, in <module>
main()
File "/Users/xxz/PycharmProjects/crypto_predictor/train_dlinear_real.py", line 30, in main
X, y, processed_df = preprocessor.preprocess_pipeline(df, task='classification', fit=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xxz/PycharmProjects/crypto_predictor/data/preprocessor.py", line 225, in preprocess_pipeline
df = self.add_technical_indicators(df)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xxz/PycharmProjects/crypto_predictor/data/preprocessor.py", line 58, in add_technical_indicators
df['bb_upper'] = bbands['BBU_20_2.0']
~~~~~~^^^^^^^^^^^^^^
File "/Users/xxz/miniforge3/envs/crypto_pred_312/lib/python3.12/site-packages/pandas/core/frame.py", line 4378, in __getitem__
indexer = self.columns.get_loc(key)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/xxz/miniforge3/envs/crypto_pred_312/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3648, in get_loc
raise KeyError(key) from err
KeyError: 'BBU_20_2.0'
ERROR conda.cli.main_run:execute(127): `conda run python train_dlinear_real.py` failed. (See above for error)
================================================================================
DLinear模型训练 - 真实Binance数据
================================================================================
[1/7] 从Binance获取BTC 1h真实数据...
✓ 使用SOCKS5代理: socks5://127.0.0.1:7890
✓ 已成功连接到Binance API
从缓存加载数据:data/cache/BTC_1h_1y_now.csv
✓ 已获取 8760 行真实数据
✓ 时间范围:2025-01-28 15:00:00 至 2026-01-28 14:00:00
[2/7] 数据预处理(技术指标 + 特征工程)...