Answers.Body: <p><strong>Environment</strong></p>
  <p>This is the manifestation of the problem being solved. It might be a real physical situation (a road network and cars), or virtual on a computer (a board game on a computer). It includes all the machinery necessary to resolve what happens. E.g. in the real world the objects involved, how the agent exerts its control when taking actions, and the applicable real-world laws of physics. Or, in a simulated world, things like the rules of a board game, implemented in code.</p>
  <p><strong>State</strong></p>
  <p>This is the representation of a &quot;position&quot; at a certain time step within the environment. It may be something the agent can observe through sensors, or be provided directly by the computer system running a simulation.</p>
  <p>For RL theory to hold, it is important that the state representation has the <a href="https://en.wikipedia.org/wiki/Markov_property" rel="nofollow noreferrer">Markov Property</a>, which is that the state accurately foretells the probabilities of rewards and following state for each action that could be taken. You do not need to <em>know</em> those probabilities in order to run RL algorithms (in fact it is a common case that you don't know). However, it is important that the dependency between the state+action and what happens next holds reliably.</p>
  <p>The state is commonly represented by a vector of values. These describe positions of pieces in a game, or positions and velocities of objects that have been sensed. A state may be built from observations, but does not have to match 1-to-1 with a single observation. Care must be taken to have enough information to have the Markov Property. So, for instance, a single image from a camera does not capture velocity - if velocity is important to your problem, you may need multiple consecutive images to build a useful state.</p>
  <p><strong>Model</strong></p>
  <p>In reinforcement learning, the term &quot;model&quot; specifically means a predictive model of the environment that resolves probabilities of next reward and next state following an action from a state. The model might be provided by the code for the environment, or it can be learned (separately to learning to behave in that environment).</p>
  <p>Some RL algorithms can make use of a model to help with learning. Planning algorithms require one. So called &quot;model free&quot; algorithms do not because they do not make use of an explicit model, they work purely from experience.</p>
  <p>There are broadly two types of model:</p>
  <ul>
  <li><p>A distribution model which provides probabilities of all events. The most general function for this might be <span class="math-container">$p(r,s'|s,a)$</span> which is the probability of receiving reward <span class="math-container">$r$</span> and transitioning to state <span class="math-container">$s'$</span> given starting in state <span class="math-container">$s$</span> and taking action <span class="math-container">$a$</span>.</p>
  </li>
  <li><p>A sampling model which generates reward <span class="math-container">$r$</span> and next state <span class="math-container">$s'$</span> when given a current state <span class="math-container">$s$</span> and action <span class="math-container">$a$</span>. The samples might be from a simulation, or just taken from history of what the learning algorithm has experienced so far.</p>
  </li>
  </ul>
  <p>In more general stats/ML, the term &quot;model&quot; is more inclusive, and can mean any predictive system that you might build, not just predictions of next reward and state. However, the literature for RL typically avoids calling those &quot;model&quot;, and uses terms like &quot;function approximator&quot; to avoid overloading the meaning of &quot;model&quot;.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-18T20:25:55.333Z
Answers.LastActivityDate: 2021-03-16T08:17:43.690Z
Answers.LastEditDate: 2021-03-16T08:17:43.690Z
Answers.UserDisplayName: Neil Slater
Body: <p>In particular, I would like to have a simple definition of "environment" and "state". What are the differences between those two concepts? Also, I would like to know how the concept of model relates to the other two. </p>
  
  <p>There is a similar question <a href="https://ai.stackexchange.com/q/5970/2444">What is the difference between an observation and a state in reinforcement learning?</a>, but it is not exactly what I was looking for.</p>
  
Tags: <reinforcement-learning><terminology><definitions>
Title: What is the relation between an environment, a state and a model?
UserDisplayName: Diego Orellana
ThreadText: # What is the relation between an environment, a state and a model?
  
  (Asked by: username_0 on 2018-08-18)
  
  In particular, I would like to have a simple definition of "environment" and "state". What are the differences between those two concepts? Also, I would like to know how the concept of model relates to the other two.
  
  There is a similar question [What is the difference between an observation and a state in reinforcement learning?](https://ai.stackexchange.com/q/5970/2444), but it is not exactly what I was looking for.
  
  **Tags:** reinforcement-learning, terminology, definitions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-18. Score: 6 | Accepted answer
  
  **Environment**
  
  This is the manifestation of the problem being solved. It might be a real physical situation (a road network and cars), or virtual on a computer (a board game on a computer). It includes all the machinery necessary to resolve what happens. E.g. in the real world the objects involved, how the agent exerts its control when taking actions, and the applicable real-world laws of physics. Or, in a simulated world, things like the rules of a board game, implemented in code.
  
  **State**
  
  This is the representation of a "position" at a certain time step within the environment. It may be something the agent can observe through sensors, or be provided directly by the computer system running a simulation.
  
  For RL theory to hold, it is important that the state representation has the [Markov Property](https://en.wikipedia.org/wiki/Markov_property), which is that the state accurately foretells the probabilities of rewards and following state for each action that could be taken. You do not need to *know* those probabilities in order to run RL algorithms (in fact it is a common case that you don't know). However, it is important that the dependency between the state+action and what happens next holds reliably.
  
  The state is commonly represented by a vector of values. These describe positions of pieces in a game, or positions and velocities of objects that have been sensed. A state may be built from observations, but does not have to match 1-to-1 with a single observation. Care must be taken to have enough information to have the Markov Property. So, for instance, a single image from a camera does not capture velocity - if velocity is important to your problem, you may need multiple consecutive images to build a useful state.
  
  **Model**
  
  In reinforcement learning, the term "model" specifically means a predictive model of the environment that resolves probabilities of next reward and next state following an action from a state. The model might be provided by the code for the environment, or it can be learned (separately to learning to behave in that environment).
  
  Some RL algorithms can make use of a model to help with learning. Planning algorithms require one. So called "model free" algorithms do not because they do not make use of an explicit model, they work purely from experience.
  
  There are broadly two types of model:
  
  * A distribution model which provides probabilities of all events. The most general function for this might be $p(r,s'|s,a)$ which is the probability of receiving reward $r$ and transitioning to state $s'$ given starting in state $s$ and taking action $a$.
  * A sampling model which generates reward $r$ and next state $s'$ when given a current state $s$ and action $a$. The samples might be from a simulation, or just taken from history of what the learning algorithm has experienced so far.
  
  In more general stats/ML, the term "model" is more inclusive, and can mean any predictive system that you might build, not just predictions of next reward and state. However, the literature for RL typically avoids calling those "model", and uses terms like "function approximator" to avoid overloading the meaning of "model".
  
  
  ---
  
  