The entropy of the action distribution measures how random the policy is. Adding an entropy bonus to the objective keeps the policy exploring instead of collapsing onto one action too early.
Implement entropy(p), the Shannon entropy of a discrete distribution, with the convention that zero probabilities contribute zero.
Compute -p log p element-wise, treating zero entries as zero, then sum.
No results yet
Run your code to check it against the examples, or submit to run every test.