For imitation learning, it is easy for us to have a fit on the expert behavior, However when we encounter a new situation, we can’t solve the problem. So we imagine that there is an expert strategy in the real world, and this expert strategy will give a reward function to guide our agents to learn. AIRL is based on the past GAIL. In GAIL, we directly use GAN to fit the behavior of the agent to the expert behavior, and do not directly give the reward function. This behavior will lead to our learning is not clear and not good. Migration, so we will record the function of the discriminator in GAN as D, and use D to represent our reward function. Below I will write in detail, how this is derived.
the goal of the IRL
Firstly, we define a distribution pθ(τ). in another word, it is the expectation for the accumulated over the expert trajectory. so it can be wrote in this form. And D is the demonstrations of the expert.
the goal of IRL can been seen as training a generative model over trajectories as:
θmax{J(θ)}=θmaxEτ∼D[logpθ(τ)]
Then we calculate the gradient with respect to θ(where pθ,t=∫st′=t,at′=tpθ(τ) denote the state-action marginal at time t): ∂θ∂J(θ)=∑t=0TED[∂θ∂rθ(st,at)]−Epθ,t[∂θ∂rθ(st,at)]
then we do importance sampling. here we instead train a separate importance sampling distribution μ(τ) . And the μ(a∣s)=21π(a∣s)+21p(a∣s)^.π(a∣s) is our agent policy p^(a∣s) is a rough density estimate trained on the demonstrations.
So, the gradient can be convert to the form below: ∂θ∂J(θ)=∑t=0TED[∂θ∂rθ(st,at)]−Eμt[μt(st,at)pθ,t(st,at)∂θ∂rθ(st,at)]
Additionally, we wish to adapt the importance sampler π to reduce variance, by minimizing the KL divergency between π and pθ, and the KL divergency can be calculate as follow.
in a another word minimize the KL divergency is same to maximize the entropy
regularized policy objective:
maxπEπ[∑t=0Trθ(st,at)−logπ(at∣st))]
For AIRL, we calculate the D function from the loss of cross-entropy between expert demonstrations and generated samples(equal to the objective of the discriminator):