Loading...
Implement random feature subspace selection used in Random Forests.
Given a dataset with m features and a list of pre-selected feature indices (to make the output deterministic), return the data with only the selected columns.
In a real Random Forest, m features are randomly selected at each split. Here, the indices are given.
Return the subsampled feature matrix.
X = [[1, 2, 3, 4], [5, 6, 7, 8]] selected_features = [0, 2]
[[1, 3], [5, 7]]
X is a 2x4 matrix: [[1, 2, 3, 4], [5, 6, 7, 8]].selected_features list contains the indices of the features to be selected: [0, 2].X, which correspond to the values [1, 3] in the first row and [5, 7] in the second row.[[1, 3], [5, 7]].