Answers.Body: <p>This is a variant of RL value-based approach using afterstate values. These are similar to action values, but have the following properties:</p>
  <ul>
  <li><p>Afterstates treat an action as &quot;choosing a next state&quot;. This works well for deterministic environments, or in games where setting a board state is at least deterministic before any random factors might apply (such as an opponent's turn).</p>
  </li>
  <li><p>Afterstates can result in efficient functions (and efficient learning) when there are multiple paths to a given state and where the details of how that state was achieved do not matter much.</p>
  </li>
  <li><p>An afterstate value function is pretty similar to an action value function, provided the agent can predict all the state features that will result. This is not necessarily the same as needing a full model, as it does not need to account for changes after the state is selected due the environment - or opponent - but before the next time step. However, it is often more than a simple action selection, for example in tetris you may have actions which are rotate, shift, drop, but the afterstate selection will be a model of what happens to state for each allowed action selection. So some functions are needed to:</p>
  <ul>
  <li><p>Convert allowed actions to afterstates before passing them to an afterstate selection algorithm.</p>
  </li>
  <li><p>Convert selected next states to actions before passing back to the environment.</p>
  </li>
  </ul>
  </li>
  </ul>
  <p>Environments can also be written to present valid next states and only accept a valid next state as a selection from the agent. It is possible to code Tic Tac Toe agents to do this for example - the environment generates all possible next states, and the agent can select one. The environment may also check that the selected next state is a valid change from the current state. In that case you do not need any conversion between actions and afterstates, everything is handled by passing states between agent and environment. I would not expect a Tetris game and agent to be written so directly like this though.</p>
  <p>Due to the similarity of afterstate values with action values, it is straightforward to adjust other value-based methods like Q-learning or SARSA to use afterstates.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-09T17:45:50.137Z
Answers.LastActivityDate: 2021-08-09T17:57:05.850Z
Answers.LastEditDate: 2021-08-09T17:57:05.850Z
Answers.UserDisplayName: Neil Slater
Body: <p>I was looking at <a href="https://github.com/michiel-cox/Tetris-DQN" rel="nofollow noreferrer">this implementation for creating an agent for playing Tetris using DeepRL</a>.</p>
  <p>This model uses &quot;a state based on the statistics of the board after a potential action. All predictions would be compared but the action with the best state would be used&quot;.</p>
  <p>So at each iteration, it's feeding a set of future states, computed based on the current state (future state made up of statistics of the game like nb of holes in the board, cleared rows, total height...)
  to a neural network and outputs one &quot;value&quot; per future state.</p>
  <p>So at every step, you predict N &quot;values&quot; from the neural network for all N possible future states for the one you are currently in and choose the greatest one as your future state and thus associated action.</p>
  <p>Now, my issue: the implementation says it's &quot;deep Q-learning&quot;, but I do not see it that way. The action, nor some sort of current state is given as input of the network.</p>
  <p>Since it is feeding the &quot;future states&quot;, for me, it looks more like a value iteration algorithm with a neural network or at least something where you know the transition model?</p>
  <p>Did I miss something and it is actually DQN?
  If not, do you have any references for this kind of RL model? Does this have a name?</p>
  
Tags: <reinforcement-learning><q-learning><deep-rl><model-based-methods><model-free-methods>
Title: In deep reinforcement learning, what is this model with state as input and value as output?
UserDisplayName: JeanMi
ThreadText: # In deep reinforcement learning, what is this model with state as input and value as output?
  
  (Asked by: username_0 on 2021-08-09)
  
  I was looking at [this implementation for creating an agent for playing Tetris using DeepRL](https://github.com/michiel-cox/Tetris-DQN).
  
  This model uses "a state based on the statistics of the board after a potential action. All predictions would be compared but the action with the best state would be used".
  
  So at each iteration, it's feeding a set of future states, computed based on the current state (future state made up of statistics of the game like nb of holes in the board, cleared rows, total height...)
  to a neural network and outputs one "value" per future state.
  
  So at every step, you predict N "values" from the neural network for all N possible future states for the one you are currently in and choose the greatest one as your future state and thus associated action.
  
  Now, my issue: the implementation says it's "deep Q-learning", but I do not see it that way. The action, nor some sort of current state is given as input of the network.
  
  Since it is feeding the "future states", for me, it looks more like a value iteration algorithm with a neural network or at least something where you know the transition model?
  
  Did I miss something and it is actually DQN?
  If not, do you have any references for this kind of RL model? Does this have a name?
  
  **Tags:** reinforcement-learning, q-learning, deep-rl, model-based-methods, model-free-methods
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-08-09. Score: 1 | Accepted answer
  
  This is a variant of RL value-based approach using afterstate values. These are similar to action values, but have the following properties:
  
  * Afterstates treat an action as "choosing a next state". This works well for deterministic environments, or in games where setting a board state is at least deterministic before any random factors might apply (such as an opponent's turn).
  * Afterstates can result in efficient functions (and efficient learning) when there are multiple paths to a given state and where the details of how that state was achieved do not matter much.
  * An afterstate value function is pretty similar to an action value function, provided the agent can predict all the state features that will result. This is not necessarily the same as needing a full model, as it does not need to account for changes after the state is selected due the environment - or opponent - but before the next time step. However, it is often more than a simple action selection, for example in tetris you may have actions which are rotate, shift, drop, but the afterstate selection will be a model of what happens to state for each allowed action selection. So some functions are needed to:
  
    + Convert allowed actions to afterstates before passing them to an afterstate selection algorithm.
    + Convert selected next states to actions before passing back to the environment.
  
  Environments can also be written to present valid next states and only accept a valid next state as a selection from the agent. It is possible to code Tic Tac Toe agents to do this for example - the environment generates all possible next states, and the agent can select one. The environment may also check that the selected next state is a valid change from the current state. In that case you do not need any conversion between actions and afterstates, everything is handled by passing states between agent and environment. I would not expect a Tetris game and agent to be written so directly like this though.
  
  Due to the similarity of afterstate values with action values, it is straightforward to adjust other value-based methods like Q-learning or SARSA to use afterstates.
  
  
  ---
  
  