All problems
Mutual Information Gap
Problem
Return the mutual information gap (MIG) score for one factor:
MIG = (largest MI - second largest MI) / H(v)
where the MI values are the estimated mutual information between the factor and each latent dimension. When only one value is given the second largest is 0.
Hint
A high MIG means the factor is captured by only one latent dimension.
Test cases
case 1
in: [[0.5,0.2],1]
expected: 0.3
case 2
in: [[0.3,0.3],1]
expected: 0
case 3
in: [[2,1,0.5],2]
expected: 0.5
case 4
in: [[0.1],1]
expected: 0.1
Starter codePython
def mutual_information_gap(mi_values, entropy_v):
# Your code here
pass4 test cases · run your code against them in the editor