Answers.Body: <p>In RL, neural networks may intuitively be thought of as using the input features as a representation that "identifies" the input state (or input state + action pair). Think back to the "tabular" RL setting that most people first study when they learn about RL. In tabular RL, you have a table of values (state values <span class="math-container">$V(s)$</span>, or state-action values <span class="math-container">$Q(s, a)$</span>), with unique entries in the table for every state. Such a table can <strong>perfectly identify</strong> states or, in other words, <strong>perfectly disambiguate</strong> different states.</p>
  
  <p>In a non-tabular, function approximation setting, with function approximators such as Neural Networks, you can generally no longer uniquely identify every single state. Instead, you use approximate representations of these states, and the approximation implies that it's possible that you have multiple different states that look identical; they have identical input features. This is the case you're dealing with. Now, you specified explicitly that these multiple states with identical representations / input features follow each other up immediately in a single episode, but I don't think this detail is particularly important. You'd have exactly the same problems if these different states with identical representation showed up at different times within an episode. The only problem that you really have is a <strong>disambiguation problem</strong>: you don't know how to disambiguate these states, since they look identical to the network.</p>
  
  <p>How significant that problem is depends on your domain. Based on your domain knowledge, do you expect the optimal action, or the optimal values, to be kind of similar in all these states that have identical features? If so, no problem! Your network already thinks they're the same anyway, so it will learn that the same actions / same values are the best in those states. But do you expect the optimal actions / true value functions to be wildly different in these states despite the fact that a network can't disambiguate them? In this case, the problem will be more severe because you can't realistically expect your network to learn the optimal actions / value functions for all these different states. At best, it can learn a weighted average among them (weighted by how commonly they occur in your training episodes).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-20T21:45:10.980Z
Answers.Text: Thanks for you answer, very elaborate and I realize now that indeed I am facing a disambiguation problem. Although, I would like to add to this to make it more clear. Assuming repetitive states lead to optimal solutions, then there is no problem. How well will the NN be able to generalize if eventually a lot of the cases are repetitive?
Answers.UserDisplayName: mkanakis
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-21T08:39:14.440Z
Answers.Text: @mkanakis In fact, this phenomenon where multiple different states can look identical (or, in less extreme cases, just look similar by having similar-but-not-necessarily-identical inputs) is precisely where the power of NNs (and other function approximators) to generalise comes from. If every state looks equally different to every other state -- as is the case in tabular RL -- you have to learn separately for every state and cannot generalise.
Answers.UserDisplayName: Dennis Soemers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-21T08:43:01.517Z
Answers.Text: Ah but if with "generalise" you're thinking of generalising to new states with different feature vectors that you didn't see before, then it can be a problem yes. If every single state you train on looks the same, your NN will "overfit" to states that look exactly like that. This is not a problem with repetitive states per se though, it's more a problem of your training data not being representative of all the data you're interested in. Such a mismatch can, in theory, also happen without repetitions in training data.
Answers.UserDisplayName: Dennis Soemers
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-20T20:01:25.373Z
Answers.LastActivityDate: 2020-05-20T20:01:25.373Z
Answers.UserDisplayName: Dennis Soemers
Body: <p>Let's say you are training a neural network in an RL setting, where the state (i.e. features/input data) can be the same for multiple successive steps (~typically around 8 steps) of an episode.</p>
  
  <p>For example, an initial state might consist of the following values:</p>
  
  <pre><code>[30, 0.2, 0.5, 1, 0]
  </code></pre>
  
  <p>And then again the same state could be fed into the neural network for e.g. 6-7 times more, resulting in ultimately the following input arrays:</p>
  
  <pre><code>[[30, 0.2, 0.5, 1, 0], 
   [30, 0.2, 0.5, 1, 0], 
   ..., 
   [30, 0.2, 0.5, 1, 0]]
  </code></pre>
  
  <p>I know that the value 0 in the feature set depicts that the weight for this feature results in insignificant value. </p>
  
  <p>But what about the repetition of values? How does that affect learning, if it does at all? Any ideas?</p>
  
  <p><em>Edit:</em> I am going to provide more information as requested in the comments.</p>
  
  <p>The reason I did not provide this information in the first place, is because I thought there would be similarities in such cases across problems/domains of application. But it is also fine to make it more specific.</p>
  
  <ol>
  <li><p>The output of the network is a probability among two paths. Our network has to select an optimal path based on some gathered network statistics.</p></li>
  <li><p>I will be using A3C, as similar work in the bibliography has made progress.</p></li>
  <li><p>The reason the agent is staying in the same state is the fact that the protocol <strong><em>can also</em></strong> make path selection decisions at the same time, without an actual update of network statistics. So in that case, you would have the same RTT for instance.</p>
  
  <p>i. This is a product of concurrency in the protocol</p>
  
  <p>ii. It is expected behavior </p></li>
  </ol>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-20T12:09:10.937Z
Comments.Text: You also asked this question here: https://datascience.stackexchange.com/q/74490/10640. Note that AI SE is probably the most appropriate site to ask questions related to reinforcement learning. Also, note that maybe nobody that visits our or other sites may know the answer to your question. I suggest you delete the other question from Data Science SE.
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-20T12:13:24.957Z
Comments.Text: Just to clarify your question, so, for $k$ successive steps of an episode, the network that represents the value function or policy will always receive the same state as input? So, basically, the agent could be in the same state for multiple successive time steps? Is this your question? And are you asking how does this affect the training of the neural network?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-20T12:20:50.870Z
Comments.Text: @nbro Hi, thanks for replying. Yes I also asked the question there (with a link here ofc), after noticing that my previous question did not get any replies as well. I thought, and since DataScience seems to be a bigger community, that I could give it a shot. I also noticed that a lot of ML questions are asked on DataScience, so it kind of made sense. Regarding the question, yes you got it right, that is exactly what I am asking.
Comments.UserDisplayName: mkanakis
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-20T12:42:58.030Z
Comments.Text: ML questions are on-topic on DS SE, but RL questions are more appropriate for AI SE. Anyway, what is the output of your network? How are you going to train it? Are you using or intend to use deep Q-learning? Maybe it may be useful to describe the actual problem that you want to solve (i.e. why would the agent stay in the same state for multiple steps)?
Comments.UserDisplayName: nbro
Tags: <neural-networks><deep-learning><reinforcement-learning><deep-rl>
Title: How does the repetition of features across states at different time steps affect learning?
UserDisplayName: mkanakis
ThreadText: # How does the repetition of features across states at different time steps affect learning?
  
  (Asked by: username_0 on 2020-05-18)
  
  Let's say you are training a neural network in an RL setting, where the state (i.e. features/input data) can be the same for multiple successive steps (~typically around 8 steps) of an episode.
  
  For example, an initial state might consist of the following values:
  
  ```
  [30, 0.2, 0.5, 1, 0]
  
  ```
  
  And then again the same state could be fed into the neural network for e.g. 6-7 times more, resulting in ultimately the following input arrays:
  
  ```
  [[30, 0.2, 0.5, 1, 0], 
   [30, 0.2, 0.5, 1, 0], 
   ..., 
   [30, 0.2, 0.5, 1, 0]]
  
  ```
  
  I know that the value 0 in the feature set depicts that the weight for this feature results in insignificant value.
  
  But what about the repetition of values? How does that affect learning, if it does at all? Any ideas?
  
  *Edit:* I am going to provide more information as requested in the comments.
  
  The reason I did not provide this information in the first place, is because I thought there would be similarities in such cases across problems/domains of application. But it is also fine to make it more specific.
  
  1. The output of the network is a probability among two paths. Our network has to select an optimal path based on some gathered network statistics.
  2. I will be using A3C, as similar work in the bibliography has made progress.
  3. The reason the agent is staying in the same state is the fact that the protocol ***can also*** make path selection decisions at the same time, without an actual update of network statistics. So in that case, you would have the same RTT for instance.
  
     i. This is a product of concurrency in the protocol
  
     ii. It is expected behavior
  
  **Tags:** neural-networks, deep-learning, reinforcement-learning, deep-rl
  
  > **Comments:**
  > **username_1**: You also asked this question here: https://datascience.stackexchange.com/q/74490/10640. Note that AI SE is probably the most appropriate site to ask questions related to reinforcement learning. Also, note that maybe nobody that visits our or other sites may know the answer to your question. I suggest you delete the other question from Data Science SE.  
  > **username_1**: Just to clarify your question, so, for $k$ successive steps of an episode, the network that represents the value function or policy will always receive the same state as input? So, basically, the agent could be in the same state for multiple successive time steps? Is this your question? And are you asking how does this affect the training of the neural network?  
  > **username_0**: @username_1 Hi, thanks for replying. Yes I also asked the question there (with a link here ofc), after noticing that my previous question did not get any replies as well. I thought, and since DataScience seems to be a bigger community, that I could give it a shot. I also noticed that a lot of ML questions are asked on DataScience, so it kind of made sense. Regarding the question, yes you got it right, that is exactly what I am asking.  
  > **username_1**: ML questions are on-topic on DS SE, but RL questions are more appropriate for AI SE. Anyway, what is the output of your network? How are you going to train it? Are you using or intend to use deep Q-learning? Maybe it may be useful to describe the actual problem that you want to solve (i.e. why would the agent stay in the same state for multiple steps)?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-05-20. Score: 1 | Accepted answer
  
  In RL, neural networks may intuitively be thought of as using the input features as a representation that "identifies" the input state (or input state + action pair). Think back to the "tabular" RL setting that most people first study when they learn about RL. In tabular RL, you have a table of values (state values $V(s)$, or state-action values $Q(s, a)$), with unique entries in the table for every state. Such a table can **perfectly identify** states or, in other words, **perfectly disambiguate** different states.
  
  In a non-tabular, function approximation setting, with function approximators such as Neural Networks, you can generally no longer uniquely identify every single state. Instead, you use approximate representations of these states, and the approximation implies that it's possible that you have multiple different states that look identical; they have identical input features. This is the case you're dealing with. Now, you specified explicitly that these multiple states with identical representations / input features follow each other up immediately in a single episode, but I don't think this detail is particularly important. You'd have exactly the same problems if these different states with identical representation showed up at different times within an episode. The only problem that you really have is a **disambiguation problem**: you don't know how to disambiguate these states, since they look identical to the network.
  
  How significant that problem is depends on your domain. Based on your domain knowledge, do you expect the optimal action, or the optimal values, to be kind of similar in all these states that have identical features? If so, no problem! Your network already thinks they're the same anyway, so it will learn that the same actions / same values are the best in those states. But do you expect the optimal actions / true value functions to be wildly different in these states despite the fact that a network can't disambiguate them? In this case, the problem will be more severe because you can't realistically expect your network to learn the optimal actions / value functions for all these different states. At best, it can learn a weighted average among them (weighted by how commonly they occur in your training episodes).
  
  > **Comments:**
  > **username_0**: Thanks for you answer, very elaborate and I realize now that indeed I am facing a disambiguation problem. Although, I would like to add to this to make it more clear. Assuming repetitive states lead to optimal solutions, then there is no problem. How well will the NN be able to generalize if eventually a lot of the cases are repetitive?  
  > **username_2**: @username_0 In fact, this phenomenon where multiple different states can look identical (or, in less extreme cases, just look similar by having similar-but-not-necessarily-identical inputs) is precisely where the power of NNs (and other function approximators) to generalise comes from. If every state looks equally different to every other state -- as is the case in tabular RL -- you have to learn separately for every state and cannot generalise.  
  > **username_2**: Ah but if with "generalise" you're thinking of generalising to new states with different feature vectors that you didn't see before, then it can be a problem yes. If every single state you train on looks the same, your NN will "overfit" to states that look exactly like that. This is not a problem with repetitive states per se though, it's more a problem of your training data not being representative of all the data you're interested in. Such a mismatch can, in theory, also happen without repetitions in training data.  
  
  ---
  
  