Answers.Body: <p>Inverse Reinforcement Learning (IRL) is a technique that attempts to recover the reward function that the expert is implicitly maximising based on expert demonstrations. When solving reinforcement learning problems, the agent maximises a reward function specified by the designer, and in the process of reward maximisation, accomplishes some task that it had set out to do. However, reward functions for certain tasks are sometimes difficult to specify by hand. For example the task of driving takes into consideration many different factors such as the distance of the car in front of him, the road conditions and whether or not the person needs to get to his destination quickly. A reward function can be hand specified based on these features. However, when there exists trade offs between these different features, it is difficult to know how to specify the different desiderata of these tradeoffs.</p>
  <p>Instead of specifying the trade offs manually, it would be easier to recover a reward function from expert demonstrations using IRL. Such a reward function can lead to better generalisations to unseen states as long as the features of driving do not change.</p>
  <p>In the case where reward shaping fails to learn a task (such as driving), it would be better to have someone demonstrate a task and learn a reward function from these demonstrations. Solving the MDP with the learnt reward function will thus yield a policy that should resemble the demonstrated behaviour. The reward function learnt should also generalise to unseen states and the agent acting in unseen states should be able to perform actions that an expert would take when he is placed in the same conditions, assuming that the unseen states come from the same distribution as the training states.</p>
  <p>While Reward Shaping might be able to perform the same task as well, IRL might be able to do better, based on some performance metric that will differ from problem to problem.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-02T09:28:35.467Z
Answers.LastActivityDate: 2020-07-02T09:28:35.467Z
Answers.UserDisplayName: calveeen
Body: <p>I am working on a research project about the different reward functions being used in the RL domain. I have read up on <strong>Inverse Reinforcement Learning (IRL)</strong> and <strong>Reward Shaping (RS)</strong>. I would like to clarify some doubts that I have with the 2 concepts.</p>
  <p>In the case of IRL, the goal is to find a reward function based on the policy that experts take. I have read that recovering the reward function that experts were trying to optimize, and then finding an optimal policy from those expert demonstrations has a possibility of resulting in a better policy (e.g. apprenticeship learning). Why does it lead to a better policy?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-01T15:13:44.177Z
Comments.Text: You're asking two distinct questions here. I suggest that you split this post into two.
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-01T16:52:09.910Z
Comments.Text: RL does not "specify immediate rewards". It often calculates a value (state value or action value), which then can be used to select an action. The value is the *expected return*, which is calculated from rewards. Although this may seem like nit-picking, it is important to get the terminology solid in a question, otherwise you will get answers that simply correct your terminology when you want other information. If you undertand the difference between return and reward (and I think you do from other questions), please fix this in the question
Comments.UserDisplayName: Neil Slater
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-01T17:05:09.913Z
Comments.Text: Note that IRL, in comparison, really does calculate an immediate reward function. So the difference between IRL doing that, and the value functions of RL is probably part of your question.
Comments.UserDisplayName: Neil Slater
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-02T08:55:09.367Z
Comments.Text: Hi @NeilSlater thank you for the comment, I will edit the question accordingly.
Comments.UserDisplayName: calveeen
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-02T09:00:33.717Z
Comments.Text: Actually I think there is no definite answer to this question, based on what I have gathered i will try to answer my own question.
Comments.UserDisplayName: calveeen
Tags: <reinforcement-learning><deep-rl><rewards><reward-shaping><inverse-rl>
Title: Can recovering a reward function using IRL lead to better policies compared to reward shaping?
UserDisplayName: calveeen
ThreadText: # Can recovering a reward function using IRL lead to better policies compared to reward shaping?
  
  (Asked by: username_0 on 2020-02-13)
  
  I am working on a research project about the different reward functions being used in the RL domain. I have read up on **Inverse Reinforcement Learning (IRL)** and **Reward Shaping (RS)**. I would like to clarify some doubts that I have with the 2 concepts.
  
  In the case of IRL, the goal is to find a reward function based on the policy that experts take. I have read that recovering the reward function that experts were trying to optimize, and then finding an optimal policy from those expert demonstrations has a possibility of resulting in a better policy (e.g. apprenticeship learning). Why does it lead to a better policy?
  
  **Tags:** reinforcement-learning, deep-rl, rewards, reward-shaping, inverse-rl
  > **Comments:**
  > **username_1**: You're asking two distinct questions here. I suggest that you split this post into two.  
  > **username_2**: RL does not "specify immediate rewards". It often calculates a value (state value or action value), which then can be used to select an action. The value is the *expected return*, which is calculated from rewards. Although this may seem like nit-picking, it is important to get the terminology solid in a question, otherwise you will get answers that simply correct your terminology when you want other information. If you undertand the difference between return and reward (and I think you do from other questions), please fix this in the question  
  > **username_2**: Note that IRL, in comparison, really does calculate an immediate reward function. So the difference between IRL doing that, and the value functions of RL is probably part of your question.  
  > **username_0**: Hi @NeilSlater thank you for the comment, I will edit the question accordingly.  
  > **username_0**: Actually I think there is no definite answer to this question, based on what I have gathered i will try to answer my own question.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-07-02. Score: 2
  
  Inverse Reinforcement Learning (IRL) is a technique that attempts to recover the reward function that the expert is implicitly maximising based on expert demonstrations. When solving reinforcement learning problems, the agent maximises a reward function specified by the designer, and in the process of reward maximisation, accomplishes some task that it had set out to do. However, reward functions for certain tasks are sometimes difficult to specify by hand. For example the task of driving takes into consideration many different factors such as the distance of the car in front of him, the road conditions and whether or not the person needs to get to his destination quickly. A reward function can be hand specified based on these features. However, when there exists trade offs between these different features, it is difficult to know how to specify the different desiderata of these tradeoffs.
  
  Instead of specifying the trade offs manually, it would be easier to recover a reward function from expert demonstrations using IRL. Such a reward function can lead to better generalisations to unseen states as long as the features of driving do not change.
  
  In the case where reward shaping fails to learn a task (such as driving), it would be better to have someone demonstrate a task and learn a reward function from these demonstrations. Solving the MDP with the learnt reward function will thus yield a policy that should resemble the demonstrated behaviour. The reward function learnt should also generalise to unseen states and the agent acting in unseen states should be able to perform actions that an expert would take when he is placed in the same conditions, assuming that the unseen states come from the same distribution as the training states.
  
  While Reward Shaping might be able to perform the same task as well, IRL might be able to do better, based on some performance metric that will differ from problem to problem.
  
  
  ---
  
  