Skip to content
DeepForgeby svx
All problems
EasyML Fundamentalsml-060

Variance Threshold

Problem

Return the indices of features whose population variance (divide by n) is strictly greater than threshold.

Empty input returns [].

Hint

Compute each column's variance and keep columns above the threshold.

Test cases

case 1
in: [[[1,1],[2,1],[3,1]],0.1]
expected: [0]
case 2
in: [[[0,1,5],[2,1,5],[4,1,6]],0.5]
expected: [0]
case 3
in: [[[1,2],[3,4]],10]
expected: []
case 4
in: [[],0]
expected: []
Starter codePython
def variance_threshold(X, threshold):
    # Your code here
    pass

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