Skip to content
DeepForgeby svx
All problems
EasyML Fundamentalsml-259

Random Subspace Count

Problem

Count the number of feature subsets of size m from d features: C(d, m).

Return 0 when m is negative or larger than d.

Hint

The number of subspaces grows combinatorially with the feature count.

Test cases

case 1
in: [5,3]
expected: 10
case 2
in: [4,2]
expected: 6
case 3
in: [3,0]
expected: 1
case 4
in: [3,4]
expected: 0
Starter codePython
def random_subspace_count(d, m):
    # Your code here
    pass

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