Answers.Body: <p>Reward functions often depend on variables not present in the current state.  Trading is the perfect example.  Try as we might, we are unlikely to capture every variable necessary to perfectly predict the movement of a price and in effect the agent's reward.  This is not typically a desirable property for an environment to have.</p>
  <p>But if as you say the present positions are not important for calibration then feel free to test the hypothesis.  I can drive a car without a speedometer but do not ask me to drive with a blindfold on.  Not every missing variable has disastrous consequences despite their effect on the reward.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-03-19T21:28:35.017Z
Answers.LastActivityDate: 2024-03-19T21:28:35.017Z
Answers.UserDisplayName: foreverska
Body: <p><strong>Question:</strong> Is it OK to have a reward function on a DQN or any RL algorithm that depends on variables other than the enviroment state? I'm asking because, so far I'm learning from tutorials, but I've never seen a reward function working with something else than enviroment.</p>
  <p><strong>My Case:</strong> Imagine a trading bot. In order to get the reward, I'd neet to know the position (how much of a stock/cryptocurrency I have) to know if the bot won or lost money in the taken step. But I don't want to have current position on the enviroment's state as it is not important for calibration. Important variables in enviroment are other key market indicators.</p>
  <p>I thought on having a separate variable with auxiliar data such as current position. So reward function would rely on new_state, previous_state and aux_data.</p>
  <p>Is this OK? Bad practice?</p>
  
Tags: <reinforcement-learning><machine-learning><deep-rl><dqn><reward-functions>
Title: Can/should a reward function depend on something other than state in a DQN
UserDisplayName: Oliver Mohr Bonometti
ThreadText: # Can/should a reward function depend on something other than state in a DQN
  
  (Asked by: username_0 on 2024-03-19)
  
  **Question:** Is it OK to have a reward function on a DQN or any RL algorithm that depends on variables other than the enviroment state? I'm asking because, so far I'm learning from tutorials, but I've never seen a reward function working with something else than enviroment.
  
  **My Case:** Imagine a trading bot. In order to get the reward, I'd neet to know the position (how much of a stock/cryptocurrency I have) to know if the bot won or lost money in the taken step. But I don't want to have current position on the enviroment's state as it is not important for calibration. Important variables in enviroment are other key market indicators.
  
  I thought on having a separate variable with auxiliar data such as current position. So reward function would rely on new\_state, previous\_state and aux\_data.
  
  Is this OK? Bad practice?
  
  **Tags:** reinforcement-learning, machine-learning, deep-rl, dqn, reward-functions
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-03-19. Score: 2 | Accepted answer
  
  Reward functions often depend on variables not present in the current state. Trading is the perfect example. Try as we might, we are unlikely to capture every variable necessary to perfectly predict the movement of a price and in effect the agent's reward. This is not typically a desirable property for an environment to have.
  
  But if as you say the present positions are not important for calibration then feel free to test the hypothesis. I can drive a car without a speedometer but do not ask me to drive with a blindfold on. Not every missing variable has disastrous consequences despite their effect on the reward.
  
  
  ---
  
  