stats, standartized data provider

This commit is contained in:
Dobromir Popov
2025-07-28 08:35:08 +03:00
parent 6efaa27c33
commit 240d2b7877
3 changed files with 220 additions and 58 deletions

View File

@ -2139,11 +2139,25 @@ class TradingOrchestrator:
outcome_status = "✅ CORRECT" if was_correct else "❌ INCORRECT"
# Get model statistics for enhanced logging
model_stats = self.get_model_statistics(model_name)
current_loss = model_stats.current_loss if model_stats else None
best_loss = model_stats.best_loss if model_stats else None
avg_loss = model_stats.average_loss if model_stats else None
# Enhanced logging with detailed information
logger.info(f"Completed immediate training for {model_name} - {outcome_status}")
logger.info(f" Prediction: {predicted_action} ({predicted_confidence:.3f})")
logger.info(f" Prediction: {predicted_action} (confidence: {predicted_confidence:.3f})")
logger.info(f" {price_outcome}")
logger.info(f" Reward: {reward:.4f} | Time: {time_diff_seconds:.1f}s")
logger.info(f" Loss: {current_loss:.4f} | Best: {best_loss:.4f} | Avg: {avg_loss:.4f}")
logger.info(f" Outcome: {outcome_status}")
# Add performance summary
if model_name in self.model_performance:
perf = self.model_performance[model_name]
logger.info(f" Performance: {perf['accuracy']:.1%} ({perf['correct']}/{perf['total']})")
except Exception as e:
logger.error(f"Error in immediate training for {model_name}: {e}")
@ -2238,6 +2252,13 @@ class TradingOrchestrator:
f"{price_prediction_stats['accurate']}/{price_prediction_stats['total']} "
f"({price_prediction_stats['avg_error']:.2f}% avg error)")
# Enhanced logging for training evaluation
logger.info(f"Training evaluation for {model_name}:")
logger.info(f" Action: {predicted_action} | Confidence: {prediction_confidence:.3f}")
logger.info(f" Price change: {price_change_pct:+.3f}% | Time: {time_diff_seconds:.1f}s")
logger.info(f" Reward: {reward:.4f} | Correct: {was_correct}")
logger.info(f" Accuracy: {self.model_performance[model_name]['accuracy']:.1%} ({self.model_performance[model_name]['correct']}/{self.model_performance[model_name]['total']})")
# Train the specific model based on sophisticated outcome
await self._train_model_on_outcome(record, was_correct, price_change_pct, reward)