-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain_long.py
More file actions
48 lines (41 loc) · 1.47 KB
/
Copy pathtrain_long.py
File metadata and controls
48 lines (41 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
Long-duration training script for 10 hours.
Trains a model with extremely high iteration count and more data.
"""
from algo_trader.research.train import run_walk_forward_training
from algo_trader.common.logger import setup_logger
from datetime import datetime
setup_logger(level="INFO", json=False)
# Configuration for long training
model_config = {
"balanced": True,
"C": 0.1, # Stronger regularization for stability
"max_iter": 100000, # 100k iterations (will take hours)
"random_state": 42,
}
print("=" * 60)
print("🔥 LONG DURATION TRAINING SESSION (10 HOURS)")
print("=" * 60)
print(f"Start time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
print(f"Max iterations: {model_config['max_iter']:,}")
print(f"Training with MUCH MORE data (18 months training window)")
print("=" * 60)
print()
# Run with large training window
metrics, model, calibrator, model_path = run_walk_forward_training(
timeframe="1h",
target="direction_4",
train_months=18, # 18 months of training data (vs 2)
val_months=3, # 3 months validation
step_months=6, # 6 month steps (fewer splits, longer training)
gap_months=0,
calibration_method="isotonic", # More complex calibration
model_config=model_config,
)
print()
print("=" * 60)
print("✅ LONG TRAINING COMPLETED!")
print(f"End time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
print(f"Model saved to: {model_path}")
print(f"Final AUC: {metrics['aggregate']['mean_auc']:.4f}")
print("=" * 60)