This commit is contained in:
Dobromir Popov
2025-08-26 18:11:34 +03:00
parent f86457fc38
commit c39b70f6fa
4 changed files with 97 additions and 7 deletions

View File

@@ -154,7 +154,7 @@ class EnhancedRLTrainingAdapter:
'direction': direction,
'confidence': float(confidence),
'action': action_names[action_idx],
'model_state': state,
'model_state': (state.tolist() if hasattr(state, 'tolist') else state),
'context': context
}
except Exception as e:
@@ -238,6 +238,8 @@ class EnhancedRLTrainingAdapter:
predicted_price = current_price * (1 + predicted_return) if (predicted_return is not None and current_price) else current_price
# Also attach DQN-formatted state if available for training consumption
dqn_state = self._convert_to_dqn_state(base_data, context)
return {
'predicted_price': predicted_price,
'current_price': current_price,
@@ -246,6 +248,7 @@ class EnhancedRLTrainingAdapter:
'predicted_return': predicted_return,
'action': action,
'model_output': model_output,
'model_state': (dqn_state.tolist() if hasattr(dqn_state, 'tolist') else dqn_state),
'context': context
}
except Exception as e: