better logging
This commit is contained in:
@@ -4326,11 +4326,11 @@ class CleanTradingDashboard:
|
|||||||
# Safe logging with formatted values
|
# Safe logging with formatted values
|
||||||
try:
|
try:
|
||||||
price_change_str = f"{price_change_pct:+.2%}" if abs(price_change_pct) < 10 else f"{price_change_pct:+.1f}"
|
price_change_str = f"{price_change_pct:+.2%}" if abs(price_change_pct) < 10 else f"{price_change_pct:+.1f}"
|
||||||
logger.debug(f"💰 IMMEDIATE TRAINING: {symbol} {predicted_action} signal - "
|
logger.info(f"💰 IMMEDIATE TRAINING: {symbol} {predicted_action} signal - "
|
||||||
f"Price: {signal_price:.6f} → {current_price:.6f} ({price_change_str}) - "
|
f"Price: {signal_price:.6f} → {current_price:.6f} ({price_change_str}) - "
|
||||||
f"{'✅' if prediction_correct else '❌'} Correct - Reward: {final_reward:.2f}")
|
f"{'✅' if prediction_correct else '❌'} Correct - Reward: {final_reward:.2f}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"Error in training log for {symbol}: {e}")
|
logger.error(f"Error in training log for {symbol}: {e}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"Error in immediate price feedback training: {e}")
|
logger.debug(f"Error in immediate price feedback training: {e}")
|
||||||
@@ -4832,7 +4832,7 @@ class CleanTradingDashboard:
|
|||||||
logger.info(" 🔄 LOW REWARDS: May need reward scaling adjustment")
|
logger.info(" 🔄 LOW REWARDS: May need reward scaling adjustment")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"Error generating training performance report: {e}")
|
logger.warning(f"Error generating training performance report: {e}")
|
||||||
|
|
||||||
def _create_cob_features_from_inference_data(self, inference_data: Dict, signal_price: float) -> Optional[List[float]]:
|
def _create_cob_features_from_inference_data(self, inference_data: Dict, signal_price: float) -> Optional[List[float]]:
|
||||||
"""Create COB features from stored inference data for better backpropagation"""
|
"""Create COB features from stored inference data for better backpropagation"""
|
||||||
@@ -5047,7 +5047,7 @@ class CleanTradingDashboard:
|
|||||||
# 5. Train Decision Fusion model
|
# 5. Train Decision Fusion model
|
||||||
self._train_decision_fusion_on_signal(signal, trade_outcome)
|
self._train_decision_fusion_on_signal(signal, trade_outcome)
|
||||||
|
|
||||||
logger.debug(f"Trained all models on {signal['action']} signal with outcome: {trade_outcome['pnl']:.2f}")
|
logger.info(f"COMPREHENSIVE TRAINING: All models trained on {signal['action']} signal with outcome: {trade_outcome['pnl']:.2f}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"Error training models on signal: {e}")
|
logger.debug(f"Error training models on signal: {e}")
|
||||||
@@ -5130,7 +5130,7 @@ class CleanTradingDashboard:
|
|||||||
if hasattr(self.orchestrator.rl_agent, 'replay'):
|
if hasattr(self.orchestrator.rl_agent, 'replay'):
|
||||||
loss = self.orchestrator.rl_agent.replay(batch_size=32)
|
loss = self.orchestrator.rl_agent.replay(batch_size=32)
|
||||||
if loss is not None:
|
if loss is not None:
|
||||||
logger.debug(f"DQN trained on signal - loss: {loss:.4f}, reward: {reward:.2f}")
|
logger.info(f"DQN trained on signal - loss: {loss:.4f}, reward: {reward:.2f}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"Error training DQN on signal: {e}")
|
logger.debug(f"Error training DQN on signal: {e}")
|
||||||
@@ -5233,7 +5233,7 @@ class CleanTradingDashboard:
|
|||||||
if hasattr(self.orchestrator.cob_rl_agent, 'replay'):
|
if hasattr(self.orchestrator.cob_rl_agent, 'replay'):
|
||||||
loss = self.orchestrator.cob_rl_agent.replay(batch_size=32)
|
loss = self.orchestrator.cob_rl_agent.replay(batch_size=32)
|
||||||
if loss is not None:
|
if loss is not None:
|
||||||
logger.debug(f"COB RL trained on signal - loss: {loss:.4f}, reward: {reward:.2f}")
|
logger.info(f"COB RL trained on signal - loss: {loss:.4f}, reward: {reward:.2f}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug(f"Error training COB RL on signal: {e}")
|
logger.debug(f"Error training COB RL on signal: {e}")
|
||||||
@@ -6270,7 +6270,7 @@ class CleanTradingDashboard:
|
|||||||
if not hasattr(self.orchestrator, 'recent_cnn_predictions'):
|
if not hasattr(self.orchestrator, 'recent_cnn_predictions'):
|
||||||
self.orchestrator.recent_cnn_predictions = {}
|
self.orchestrator.recent_cnn_predictions = {}
|
||||||
|
|
||||||
logger.debug("Enhanced training system initialized for model predictions")
|
logger.info("Enhanced training system initialized for model predictions")
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.warning("Enhanced training system not available - using mock predictions")
|
logger.warning("Enhanced training system not available - using mock predictions")
|
||||||
@@ -7740,7 +7740,7 @@ class CleanTradingDashboard:
|
|||||||
if training_samples > 0:
|
if training_samples > 0:
|
||||||
avg_loss_info = f", avg_loss={total_loss/loss_count:.6f}" if loss_count > 0 else ""
|
avg_loss_info = f", avg_loss={total_loss/loss_count:.6f}" if loss_count > 0 else ""
|
||||||
performance_score = 100 / (1 + (total_loss/loss_count)) if loss_count > 0 else 0.1
|
performance_score = 100 / (1 + (total_loss/loss_count)) if loss_count > 0 else 0.1
|
||||||
logger.debug(f"DECISION TRAINING: Processed {training_samples} decision fusion samples{avg_loss_info}, perf_score={performance_score:.4f}")
|
logger.info(f"DECISION TRAINING: Processed {training_samples} decision fusion samples{avg_loss_info}, perf_score={performance_score:.4f}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error in real decision fusion training: {e}")
|
logger.error(f"Error in real decision fusion training: {e}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user