# How to get DQN action distribution

**URL:** <https://discuss.ray.io/t/how-to-get-dqn-action-distribution/2993>\
**Category:** RLlib\
**Created:** [July 23, 2021, 7:18pm UTC](https://discuss.ray.io/t/how-to-get-dqn-action-distribution/2993 "2021-07-23T19:18:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Showalter](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/samuel_showalter/32/1311_2.png) [@Samuel\_Showalter](https://discuss.ray.io/u/Samuel_Showalter)\
**Post date:** [July 23, 2021, 7:18pm UTC](https://discuss.ray.io/t/how-to-get-dqn-action-distribution/2993/1 "2021-07-23T19:18:30Z")

</div>

Hi,

I noticed that if I run `policy.model.from_batch(obs)` for DQN, the output is not the size of the action space but rather the size of the internal feature representation of the network, can you help me understand how to get the action distribution? Is it derived from the Q function? Apologies if this question is naive.

Thanks,  
Sam

---

<div class="post-metadata">

**Author:** ![mannyv](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/mannyv/32/606_2.png) [@mannyv](https://discuss.ray.io/u/mannyv)\
**Post date:** [July 23, 2021, 8:39pm UTC](https://discuss.ray.io/t/how-to-get-dqn-action-distribution/2993/2 "2021-07-23T20:39:45Z")

</div>

Use the compute\_actions / compute\_single\_action methods.

---

<div class="post-metadata">

**Author:** ![Dejan\_Grubisic](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/dejan_grubisic/32/2987_2.png) [@Dejan\_Grubisic](https://discuss.ray.io/u/Dejan_Grubisic)\
**Post date:** [November 3, 2022, 4:09pm UTC](https://discuss.ray.io/t/how-to-get-dqn-action-distribution/2993/3 "2022-11-03T16:09:55Z")

</div>

How to get the distribution of actions from compute\_action or compute\_actions? The documentation says they return only the best action.

This would be really important, since if your network returns an action that is impossible, how would you know the next best action to try instead?
