training wip
This commit is contained in:
@@ -2014,26 +2014,59 @@ class TradingOrchestrator:
|
||||
logger.debug(f"No fallback prediction available for {symbol}")
|
||||
return None
|
||||
|
||||
# Choose decision method based on configuration and toggle state
|
||||
# NEW BEHAVIOR: Check inference and training toggle states separately
|
||||
decision_fusion_inference_enabled = self.is_model_inference_enabled("decision_fusion")
|
||||
decision_fusion_training_enabled = self.is_model_training_enabled("decision_fusion")
|
||||
|
||||
if (
|
||||
# If training is enabled, we should also inference the model for training purposes
|
||||
# but we may not use the predictions for actions/signals depending on inference toggle
|
||||
should_inference_for_training = decision_fusion_training_enabled and (
|
||||
self.decision_fusion_enabled
|
||||
and self.decision_fusion_mode == "neural"
|
||||
and self.decision_fusion_network is not None
|
||||
)
|
||||
|
||||
# If inference is enabled, use neural decision fusion for actions
|
||||
if (
|
||||
should_inference_for_training
|
||||
and decision_fusion_inference_enabled
|
||||
):
|
||||
# Use neural decision fusion
|
||||
# Use neural decision fusion for both training and actions
|
||||
logger.debug(f"Using neural decision fusion for {symbol} (inference enabled)")
|
||||
decision = self._make_decision_fusion_decision(
|
||||
symbol=symbol,
|
||||
predictions=predictions,
|
||||
current_price=current_price,
|
||||
timestamp=current_time,
|
||||
)
|
||||
elif should_inference_for_training and not decision_fusion_inference_enabled:
|
||||
# Inference for training only, but use programmatic for actions
|
||||
logger.info(f"Decision fusion inference disabled, using programmatic mode for {symbol} (training enabled)")
|
||||
|
||||
# Make neural inference for training purposes only
|
||||
training_decision = self._make_decision_fusion_decision(
|
||||
symbol=symbol,
|
||||
predictions=predictions,
|
||||
current_price=current_price,
|
||||
timestamp=current_time,
|
||||
)
|
||||
|
||||
# Store inference for decision fusion training
|
||||
self._store_decision_fusion_inference(
|
||||
training_decision, predictions, current_price
|
||||
)
|
||||
|
||||
# Use programmatic decision for actual actions
|
||||
decision = self._combine_predictions(
|
||||
symbol=symbol,
|
||||
price=current_price,
|
||||
predictions=predictions,
|
||||
timestamp=current_time,
|
||||
)
|
||||
else:
|
||||
# Use programmatic decision combination
|
||||
if not decision_fusion_inference_enabled:
|
||||
logger.info(f"Decision fusion model disabled, using programmatic mode for {symbol}")
|
||||
# Use programmatic decision combination (no neural inference)
|
||||
if not decision_fusion_inference_enabled and not decision_fusion_training_enabled:
|
||||
logger.info(f"Decision fusion model disabled (inference and training off), using programmatic mode for {symbol}")
|
||||
else:
|
||||
logger.debug(f"Using programmatic decision combination for {symbol}")
|
||||
|
||||
@@ -2044,8 +2077,11 @@ class TradingOrchestrator:
|
||||
timestamp=current_time,
|
||||
)
|
||||
|
||||
# Train decision fusion model even in programmatic mode
|
||||
if self.decision_fusion_enabled and self.decision_fusion_network is not None:
|
||||
# Train decision fusion model even in programmatic mode if training is enabled
|
||||
if (decision_fusion_training_enabled and
|
||||
self.decision_fusion_enabled and
|
||||
self.decision_fusion_network is not None):
|
||||
|
||||
# Store inference for decision fusion (like other models)
|
||||
self._store_decision_fusion_inference(
|
||||
decision, predictions, current_price
|
||||
@@ -5562,8 +5598,8 @@ class TradingOrchestrator:
|
||||
# DEBUG: Log decision fusion input features
|
||||
logger.info(f"=== DECISION FUSION INPUT FEATURES ===")
|
||||
logger.info(f" Input shape: {input_features.shape}")
|
||||
logger.info(f" Input features (first 20): {input_features[0, :20].cpu().numpy()}")
|
||||
logger.info(f" Input features (last 20): {input_features[0, -20:].cpu().numpy()}")
|
||||
# logger.info(f" Input features (first 20): {input_features[0, :20].cpu().numpy()}")
|
||||
# logger.info(f" Input features (last 20): {input_features[0, -20:].cpu().numpy()}")
|
||||
logger.info(f" Input features mean: {input_features.mean().item():.4f}")
|
||||
logger.info(f" Input features std: {input_features.std().item():.4f}")
|
||||
|
||||
|
Reference in New Issue
Block a user