mutate_and_fix#
- mlproject.training.feature_selection.mutate_and_fix(individual, indpb, num_selected_features)[source]#
Mutate an individual and ensure it has exactly num_selected_features selected.
- Parameters:
individual (np.ndarray) – The individual to mutate.
indpb (float) – Probability for individual bits to be flipped.
num_selected_features (int) – Number of features to select (element of binary vector set to 1).