stored
This commit is contained in:
@@ -22,11 +22,24 @@ from typing import Dict, List, Optional, Any, Tuple
|
||||
from collections import deque
|
||||
import random
|
||||
import math
|
||||
import sys
|
||||
import os
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
import torch.optim as optim
|
||||
|
||||
# Add parent directory to path for imports
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
|
||||
# Import prediction database
|
||||
try:
|
||||
from core.prediction_database import get_prediction_db
|
||||
except ImportError:
|
||||
# Fallback if prediction database is not available
|
||||
def get_prediction_db():
|
||||
logger.warning("Prediction database not available, using mock")
|
||||
return None
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -2364,7 +2377,13 @@ class EnhancedRealtimeTrainingSystem:
|
||||
# Use DQN model to predict action (if available)
|
||||
if (self.orchestrator and hasattr(self.orchestrator, 'rl_agent')
|
||||
and self.orchestrator.rl_agent):
|
||||
|
||||
# Get prediction from DQN agent
|
||||
state = self.orchestrator._create_rl_state(symbol)
|
||||
if state is not None:
|
||||
action, confidence, q_values = self.orchestrator.rl_agent.act_with_confidence(state)
|
||||
else:
|
||||
# Fallback if state creation fails
|
||||
action, q_values, confidence = self._technical_analysis_prediction(symbol)
|
||||
else:
|
||||
# Fallback to technical analysis-based prediction
|
||||
action, q_values, confidence = self._technical_analysis_prediction(symbol)
|
||||
@@ -2725,8 +2744,9 @@ class EnhancedRealtimeTrainingSystem:
|
||||
|
||||
except Exception as e:
|
||||
logger.debug(f"Error estimating price change: {e}")
|
||||
return 0.0 d
|
||||
ef _save_model_checkpoint(self, model_name: str, model_obj, loss: float):
|
||||
return 0.0
|
||||
|
||||
def _save_model_checkpoint(self, model_name: str, model_obj, loss: float):
|
||||
"""
|
||||
Save model checkpoint after training if performance improved
|
||||
|
||||
|
||||
Reference in New Issue
Block a user