Baselines: PPO2 sample action strategy?

Created on 12 Apr 2018  路  3Comments  路  Source: openai/baselines

This is not a bug report.
I am confused about the PPO2 sample action strategy:
def sample(self):
u = tf.random_uniform(tf.shape(self.logits))
return tf.argmax(self.logits - tf.log(-tf.log(u)), axis=-1)

Why it is log(-log())?
Why use action_model policy output minus the random numbers: [pi - log(-log(u))]?
The pi is the action_model policy output.
Is there any references for the action sample strategy?
Thanks a lot.

Most helpful comment

That is called the Gumbel-Softmax, it is simply a mathematical trick for sampling from a categorical distribution. This is equivalent to applying the softmax to logits and sampling according to the resulting probabilities.

Relevant reading: https://arxiv.org/abs/1611.01144

All 3 comments

That is called the Gumbel-Softmax, it is simply a mathematical trick for sampling from a categorical distribution. This is equivalent to applying the softmax to logits and sampling according to the resulting probabilities.

Relevant reading: https://arxiv.org/abs/1611.01144

This is black magic. Thanks a lot.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

damienlancry picture damienlancry  路  7Comments

scotthuang1989 picture scotthuang1989  路  7Comments

DanielTakeshi picture DanielTakeshi  路  8Comments

Nara0731 picture Nara0731  路  19Comments

PolarisYxh picture PolarisYxh  路  10Comments