Skip to content
DeepForgeby svx
All problems

Skill Mutual Information

Problem

Compute the mutual information between skills and states for unsupervised skill discovery.

With a uniform state distribution, MI = (1 / n_states) * sum over states and skills of p(z|s) * ln(p(z|s) / p(z)), counting only terms with positive probability. Empty inputs return 0.0.

Hint

Maximizing this objective makes skills distinguishable from the states they visit.

Test cases

case 1
in: [[0.5,0.5],[[1,0]]]
expected: 0.6931471805599453
case 2
in: [[0.5,0.5],[[0.5,0.5],[0.5,0.5]]]
expected: 0
case 3
in: [[0.25,0.75],[[0.25,0.75],[0.5,0.5]]]
expected: 0.07192051811294521
case 4
in: [[],[]]
expected: 0
Starter codePython
import math
def skill_mutual_information(skill_probs, posteriors):
    # Your code here
    pass

4 test cases · run your code against them in the editor