All problems
Entropy Collapse Check
Problem
Detect entropy collapse: return True when the last patience entropies are all below ratio * entropies[0], and False when there are fewer entries, patience is non-positive, or any of the last entries is at or above the threshold.
Hint
A policy whose entropy keeps sinking is becoming deterministic and losing exploration.
Test cases
case 1
in: [[1,0.5,0.2,0.1],0.3,2]
expected: true
case 2
in: [[1,0.5,0.2],0.3,2]
expected: false
case 3
in: [[1],0.5,1]
expected: false
case 4
in: [[],0.5,1]
expected: false
Starter codePython
def entropy_collapse(entropies, ratio, patience):
# Your code here
pass4 test cases · run your code against them in the editor