Answers.Body: <p>Yes, this is known as <strong>imitation learning</strong>, which can be divided into</p>
  <ul>
  <li><strong>inverse RL</strong> (i.e. learn a reward function from demonstrations, then apply RL), and</li>
  <li><strong>behaviour cloning</strong> (supervised learning applied to RL).</li>
  </ul>
  <p>I don't know the state-of-the-art (I am not an expert in this topic) or whether IL is a good approach in your case, but you can check e.g. the pre-print survey <a href="https://arxiv.org/pdf/2106.12177.pdf" rel="nofollow noreferrer">Imitation Learning: Progress, Taxonomies and Opportunities</a> (2021) by Boyuan Zheng et al., which seems to nicely describe the topic.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-26T21:06:15.820Z
Answers.LastActivityDate: 2022-06-26T21:06:15.820Z
Answers.UserDisplayName: nbro
Body: <p>I'm less familiar with reinforcement learning compared to other neural network learning approaches, so I'm unaware of anything exactly like what I want for an approach. I'm wondering if there are any ways to train a Deep-Q neural network on, say, OpenAI Gym, where the model is given a recorded demonstration to learn from. That is, I'd like to do the following (with a Mario NES example):</p>
  <ul>
  <li>Play the first level of Mario and somehow record this (maybe as an input sequence?)</li>
  <li>Run the model on the level a few times until it passes</li>
  <li>Send the model to the next level, let it train for as long as possible unless it continues to fail -- if so, I'll play the level and then let it train again</li>
  <li>Repeat</li>
  </ul>
  <p>Are there any approaches similar to this that currently exist? And, would this be infeasible because the model may fail to generalize? I'd like to accomplish this with much more complicated games, but if I could use this approach to save on defining endless amounts of reward/penalty policies and ROM hacking to find the memory address of everything I want the model to use, it would be extremely helpful.</p>
  
Tags: <neural-networks><reinforcement-learning><reference-request><algorithm-request><imitation-learning>
Title: Is there a standardized method to train a reinforcement learning NN by demonstration?
UserDisplayName: Daniel S.
ThreadText: # Is there a standardized method to train a reinforcement learning NN by demonstration?
  
  (Asked by: username_0 on 2022-06-26)
  
  I'm less familiar with reinforcement learning compared to other neural network learning approaches, so I'm unaware of anything exactly like what I want for an approach. I'm wondering if there are any ways to train a Deep-Q neural network on, say, OpenAI Gym, where the model is given a recorded demonstration to learn from. That is, I'd like to do the following (with a Mario NES example):
  
  * Play the first level of Mario and somehow record this (maybe as an input sequence?)
  * Run the model on the level a few times until it passes
  * Send the model to the next level, let it train for as long as possible unless it continues to fail -- if so, I'll play the level and then let it train again
  * Repeat
  
  Are there any approaches similar to this that currently exist? And, would this be infeasible because the model may fail to generalize? I'd like to accomplish this with much more complicated games, but if I could use this approach to save on defining endless amounts of reward/penalty policies and ROM hacking to find the memory address of everything I want the model to use, it would be extremely helpful.
  
  **Tags:** neural-networks, reinforcement-learning, reference-request, algorithm-request, imitation-learning
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-06-26. Score: 4 | Accepted answer
  
  Yes, this is known as **imitation learning**, which can be divided into
  
  * **inverse RL** (i.e. learn a reward function from demonstrations, then apply RL), and
  * **behaviour cloning** (supervised learning applied to RL).
  
  I don't know the state-of-the-art (I am not an expert in this topic) or whether IL is a good approach in your case, but you can check e.g. the pre-print survey [Imitation Learning: Progress, Taxonomies and Opportunities](https://arxiv.org/pdf/2106.12177.pdf) (2021) by Boyuan Zheng et al., which seems to nicely describe the topic.
  
  
  ---
  
  