gru_sac_predictor/config.yaml
2025-04-18 16:57:38 +00:00

111 lines
6.4 KiB
YAML

# --- Data Parameters ---
data:
db_dir: '../data/crypto_market_data' # Path to the directory containing the market data database (relative to where main.py is run).
exchange: 'bnbspot' # Name of the exchange table/data source in the database.
ticker: 'SOL-USDT' # Instrument identifier (e.g., trading pair) within the exchange data.
vol_window: 30 # Task 1.1: Window size for volatility calculation
vol_quantile: 0.5 # Task 1.1: Keep samples where vol > this quantile
label_smoothing: 0.05 # Task 1.2 / Revision 2-B: Apply label smoothing to binary targets (0.0 = off, 0.1 = [0.05, 0.95])
# --- Feature Engineering Params ---
features:
# Placeholder for potential future config, like VIF skip - Task 2.5
# skip_vif: false
# Define minimal whitelist here? Or keep in feature_engineer.py fallback?
minimal_whitelist: [
"return_1m", "return_15m", "return_60m", "ATR_14", "volatility_14d",
"chaikin_AD_10", "svi_10", "EMA_10", "EMA_50",
"hour_sin", "hour_cos", "week_sin", "week_cos", # Added week cycle
# Add new micro-structure features if they prove useful and pass selection
"spread_proxy", "vol_norm_volume_spike", "return_asymmetry",
"close_location_value", "keltner_band_pos"
]
# --- Data Split (Walk-Forward Settings - Replaces split_ratios) --- #
walk_forward:
enabled: true # Enable walk-forward validation loop
train_days: 60 # Duration of the training set in days for each fold
val_days: 14 # Duration of the validation set in days for each fold
test_days: 14 # Duration of the test set in days for each fold
step_days: 14 # How many days to step forward for the next fold (usually val_days or test_days)
initial_offset_days: 0 # Optional: Skip first N days of data before starting first fold
# --- GRU Model Parameters --- #
gru:
# General
prediction_horizon: 5 # How many steps ahead the model predicts.
lookback: 60 # Sequence length input to the GRU.
# --- New Label/Version Params (v3 Rev) --- #
use_ternary: true # Task 1.3 / Revision 7: Use ternary (up/flat/down) labels instead of binary.
flat_sigma_multiplier: 0.3 # Task 1.3 / Revision 1-C / Revision 7: k for ternary flat threshold (eps = k * rolling_sigma_N).
# --- v2 Specific Params (Legacy) --- #
# --- GRU v3 Model Specific Parameters --- #
gru_v3:
# ... existing gru_v3 params ...
gru_units: 96 # Hidden units in the GRU layer
attention_units: 16 # Attention mechanism units (0 disables attention)
learning_rate: 1e-4 # Learning rate for Adam optimizer
focal_gamma: 2.0 # Gamma parameter for focal loss
focal_label_smoothing: 0.1 # Label smoothing for focal loss
huber_delta: 1.0 # Delta parameter for huber loss
loss_weight_mu: 0.3 # Weight for mu output in loss
loss_weight_dir3: 1.0 # Weight for dir3 output in loss
l2_reg: 1e-4 # L2 regularization weight
# --- Hyperparameter Tuning --- #
hyperparameter_tuning:
gru:
sweep_enabled: false # Set to true to enable hyperparameter tuning with Optuna
sweep_n_trials: 20 # Number of trials for the Optuna study
sweep_timeout: 7200 # Maximum time in seconds for the hyperparameter search
enable_pruning: true # Enable trial pruning for efficiency
pruning_warmup_trials: 5 # Number of trials before pruning is applied
# --- Calibration Parameters --- #
calibration:
method: 'vector' # Calibration method ('temperature' or 'vector')
edge_threshold: 0.2 # Default probability edge threshold (can be optimized per fold)
optimize_edge_threshold: true # If true, optimize edge_threshold per fold using Youden's J
# Rolling Calibration (Implemented in Backtester)
rolling_enabled: false # Enable rolling calibration during backtest
recalibrate_every_n: 5000 # How often (in steps/bars) to refit the calibrator during backtest
recalibration_window: 20000 # How many recent steps/bars to use for refitting
coverage_alarm_enabled: false # Enable the coverage alarm to trigger early recalibration
coverage_alarm_threshold_drop: 0.03 # Trigger alarm if hit rate < edge_thr - drop
coverage_alarm_window: 1000 # Monitor hit rate over this many bars for the alarm
# --- Validation Gates --- #
validation_gates:
baseline:
ci_lower_bound_threshold: 0.52 # Min 95% CI lower bound for logistic baseline accuracy
gru:
edge_filtered_acc_ci_lower_threshold: 0.62 # Revision 6: Updated threshold
brier_score_threshold: 0.22 # Revision 6: Updated threshold (Max allowed Brier score)
edge_filtered_min_samples: 30 # Min samples required for edge-filtered CI calculation
backtest:
# sharpe_threshold: 1.0 # Revision 6: Removed - Replaced by median check in final_release_decision
max_drawdown_threshold: 15.0 # Max allowed drawdown percentage
win_rate_threshold: 55.0 # Min win rate percentage
# Note: Median Sharpe threshold (e.g., >= 1.3 for >= 5 folds) is applied in final_release_decision
# --- SAC Agent Parameters --- #
sac:
# ... existing sac params ...
use_per: false # Enable Prioritized Experience Replay (Requires PER implemented in SACTrainer)
# ... rest of sac params ...
# --- SAC Aggregation (Post-Processing) --- #
sac_aggregation:
enabled: false # Enable aggregation/merging of SAC agents from folds
method: 'average_weights' # Strategy: 'average_weights', 'voting_ensemble' (Requires separate implementation)
# --- Environment Parameters (Used by train_sac.py & backtester.py) --- #
environment:
initial_capital: 10000.0 # Notional capital for env/backtest consistency.
transaction_cost: 0.0005 # Fractional cost per trade (e.g., 0.0005 = 0.05%).
# --- New Env Params (v3 Rev) --- #
reward_scale: 100.0 # Task 5.1 / Revision 4-A / Revision 7: Multiplier applied to the raw environment reward.
action_penalty_lambda: 0.005 # Task 5.4 / Revision 4-A / Revision 7: Coefficient (lambda) for action magnitude penalty (reward -= lambda * action^2).
# ... existing code ...