feat: enhance model training and deployment scripts with time-weighted sampling

- Updated `train_model.py` and `train_mlx_model.py` to include a time weight decay parameter for improved sample weighting during training.
- Modified dataset generation to incorporate sample weights based on time decay, enhancing model performance.
- Adjusted deployment scripts to support new backend options and improved error handling for model file transfers.
- Added new entries to the training log for better tracking of model performance metrics over time.
- Included ONNX model export functionality in the MLX filter for compatibility with Linux servers.
This commit is contained in:
21in7
2026-03-01 21:25:06 +09:00
parent 301457ce57
commit db144750a3
10 changed files with 324 additions and 97 deletions

View File

@@ -9,21 +9,17 @@ def build_labels(
stop_loss: float,
side: str,
) -> Optional[int]:
"""
진입 이후 미래 캔들을 순서대로 확인해 TP/SL 도달 여부를 판단한다.
LONG: high >= TP → 1, low <= SL → 0
SHORT: low <= TP → 1, high >= SL → 0
둘 다 미도달 → None (학습 데이터에서 제외)
"""
for high, low in zip(future_highs, future_lows):
if side == "LONG":
if high >= take_profit:
return 1
# 보수적 접근: 손절(SL)을 먼저 체크
if low <= stop_loss:
return 0
else: # SHORT
if low <= take_profit:
if high >= take_profit:
return 1
else: # SHORT
# 보수적 접근: 손절(SL)을 먼저 체크
if high >= stop_loss:
return 0
if low <= take_profit:
return 1
return None