init_valid_individual#
- mlproject.training.feature_selection.init_valid_individual(icls, n_features, num_selected_features)[source]#
Initialize an individual with a fixed number of selected features. Ensures that exactly num_selected_features in a binary vector are switched to 1.
- Parameters:
icls (Individual creator class) – The individual class to instantiate.
n_features (int) – Total number of features.
num_selected_features (int) – Number of features to select (element of binary vector set to 1).