跟特征数量没关系
Some checks are pending
Update Docker Hub Description / dockerHubDescription (push) Waiting to run

This commit is contained in:
zhangkun9038@dingtalk.com 2025-04-28 14:06:49 +08:00
parent 2f4a06d505
commit ea707fe104
2 changed files with 7 additions and 4 deletions

View File

@ -78,7 +78,7 @@
"include_corr_pairlist": ["BTC/USDT"],
"label_period_candles": 10,
"include_shifted_candles": 1,
"DI_threshold": 0.3,
"DI_threshold": 1.5,
"weight_factor": 0.9,
"principal_component_analysis": false,
"use_SVM_to_remove_outliers": false,

View File

@ -179,9 +179,10 @@ class FreqaiExampleStrategy(IStrategy):
label_period = self.freqai_info["feature_parameters"]["label_period_candles"]
# 生成更复杂的目标变量 up_or_down
dataframe["up_or_down"] = np.where(
dataframe["close"].shift(-label_period) > dataframe["close"], 1, 0
)
# Ensure the target variable is reshaped correctly
dataframe["up_or_down"] = np.where(
dataframe["close"].shift(-label_period) > dataframe["close"], 1, 0
).reshape(-1, 1) # Reshape to 2D array
# 生成 %-volatility 特征
dataframe["%-volatility"] = dataframe["close"].pct_change().rolling(20).std()
@ -202,6 +203,8 @@ class FreqaiExampleStrategy(IStrategy):
logger.error(f"创建 FreqAI 目标失败:{str(e)}")
raise
# Log the shape of the target variable for debugging
logger.info(f"目标列形状:{dataframe['up_or_down'].shape}")
logger.info(f"目标列预览:\n{dataframe[['up_or_down', '&-buy_rsi']].head().to_string()}")
return dataframe