All problems
Factor Analysis Loading Norm
Problem
In factor analysis the loading matrix maps latent factors to observed features. Return the Euclidean norm of column factor of loadings, that is the square root of the sum of squared loadings of that factor. Return 0.0 for an empty matrix or an out-of-range factor index.
Hint
The column norm measures how strongly a factor loads on the observed features.
Test cases
case 1
in: [[[0.5,0.8],[0.3,0.6]],0]
expected: 0.58309518948453
case 2
in: [[[0.5,0.8],[0.3,0.6]],1]
expected: 1
case 3
in: [[[1],[2]],0]
expected: 2.23606797749979
case 4
in: [[[1,2],[3,4]],5]
expected: 0
case 5
in: [[],0]
expected: 0
Starter codePython
import math
def factor_analysis_loading_norm(loadings, factor):
# Your code here
pass5 test cases · run your code against them in the editor