fix: 修正回归训练中的未来收益率计算公式

- 修复 Label 公式从过去收益率改为未来收益率
This commit is contained in:
2026-03-06 20:56:24 +08:00
parent 7b935b0fa3
commit 555cb00276

View File

@@ -1,7 +1,7 @@
"""LightGBM 回归训练示例 - 使用因子字符串表达式
使用字符串表达式定义因子,训练 LightGBM 回归模型预测未来5日收益率。
Label: return_5 = (close / ts_delay(close, 5)) - 1
Label: return_5 = (ts_delay(close, -5) / close) - 1 # 未来5日收益率
"""
import os
@@ -19,7 +19,8 @@ from src.training import (
StockFilterConfig,
StockPoolManager,
Trainer,
Winsorizer, NullFiller,
Winsorizer,
NullFiller,
)
from src.training.config import TrainingConfig
@@ -56,7 +57,7 @@ FACTOR_DEFINITIONS = {
# Label 因子定义(不参与训练,用于计算目标)
LABEL_FACTOR = {
"return_5": "(close / ts_delay(close, 5)) - 1",
"return_5": "(ts_delay(close, -5) / close) - 1", # 未来5日收益率
}
# =============================================================================