From: Jérôme Benoit Date: Sun, 1 Mar 2026 18:54:50 +0000 (+0100) Subject: feat(reforcexy): log invalid actions with enum names for non-masking models X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=74b8b440d2cb7f415e3ad094ffefc1f74e55d765;p=freqai-strategies.git feat(reforcexy): log invalid actions with enum names for non-masking models --- diff --git a/ReforceXY/user_data/freqaimodels/ReforceXY.py b/ReforceXY/user_data/freqaimodels/ReforceXY.py index d003a3a..eebdb2c 100644 --- a/ReforceXY/user_data/freqaimodels/ReforceXY.py +++ b/ReforceXY/user_data/freqaimodels/ReforceXY.py @@ -1216,7 +1216,12 @@ class ReforceXY(BaseReinforcementLearningModel): ) episode_start[:] = False action = int(action.item()) - logger.debug("Predict [%s]: predicted action=%d", dk.pair, action) + logger.debug( + "Predict [%s]: predicted action=%s (%d)", + dk.pair, + Actions(action).name, + action, + ) else: logger.debug( "Predict [%s]: model.predict (observations.shape=%s)", @@ -1227,7 +1232,12 @@ class ReforceXY(BaseReinforcementLearningModel): observations, deterministic=True, **action_masks_param ) action = int(action.item()) - logger.debug("Predict [%s]: predicted action=%d", dk.pair, action) + logger.debug( + "Predict [%s]: predicted action=%s (%d)", + dk.pair, + Actions(action).name, + action, + ) return action @@ -3375,6 +3385,15 @@ class MyRLEnv(Base5ActionRLEnv): trade_type = self.execute_trade(action) if trade_type is not None: self.append_trade_history(trade_type, self.current_price(), pre_pnl) + elif action != Actions.Neutral.value: + logger.warning( + "Env [%s]: invalid action=%s (%d) in position=%s at tick=%d", + self.id, + Actions(action).name, + action, + self._position.name, + self._current_tick, + ) self._position_history.append(self._position) terminated = self.is_terminated() if terminated: