Explore Library
Code QuizIntermediate

Random Forest Feature Subsampling

Spotting a bug in selecting a random feature subset at each split.

Codepython
import numpy as np
import random

def select_features(n_features):
    # pick sqrt(n_features) candidate features for this split
    k = int(np.sqrt(n_features))
    return random.choices(range(n_features), k=k)

What is the bug in this feature-subsampling helper?