All problems
Redundancy Index
Problem
Return the redundancy index rc^2 * mean(squared_loadings), the share of one variable set's variance explained by the other set's canonical variate. Return 0.0 for empty loadings.
Hint
Redundancy is the intersection of shared variance with the variance actually extracted.
Test cases
case 1
in: [0.8,[0.7,0.6,0.5]]
expected: 0.38400000000000006
case 2
in: [0.5,[1]]
expected: 0.25
case 3
in: [0.9,[0.9,0.8]]
expected: 0.6885000000000001
case 4
in: [0,[0.5,0.5]]
expected: 0
case 5
in: [0.6,[]]
expected: 0
Starter codePython
def redundancy_index(rc, squared_loadings):
# Your code here
pass5 test cases · run your code against them in the editor