training fixes and enhancements wip

This commit is contained in:
Dobromir Popov
2025-07-14 10:00:42 +03:00
parent e76b1b16dc
commit e74f1393c4
6 changed files with 378 additions and 99 deletions

View File

@ -134,8 +134,8 @@ class TrainingIntegration:
# Store experience in DQN memory
dqn_agent = self.orchestrator.dqn_agent
if hasattr(dqn_agent, 'store_experience'):
dqn_agent.store_experience(
if hasattr(dqn_agent, 'remember'):
dqn_agent.remember(
state=np.array(dqn_state),
action=action_idx,
reward=reward,
@ -145,7 +145,7 @@ class TrainingIntegration:
# Trigger training if enough experiences
if hasattr(dqn_agent, 'replay') and len(getattr(dqn_agent, 'memory', [])) > 32:
dqn_agent.replay(batch_size=32)
dqn_agent.replay()
logger.info("DQN training step completed")
return True
@ -345,7 +345,7 @@ class TrainingIntegration:
# Perform training step if agent has replay method
if hasattr(cob_rl_agent, 'replay') and hasattr(cob_rl_agent, 'memory'):
if len(cob_rl_agent.memory) > 32: # Enough samples to train
loss = cob_rl_agent.replay(batch_size=min(32, len(cob_rl_agent.memory)))
loss = cob_rl_agent.replay()
if loss is not None:
logger.info(f"COB RL trained on trade outcome: P&L=${pnl:.2f}, loss={loss:.4f}")
return True