mlproject.training.feature_selection

mlproject.training.feature_selection#

Functions for feature reduction and selection.

Functions

cxTwoPointAndFix

Crossover two individuals and fix them to have a specific number of selected features.

get_relevant_features

Build and apply a feature selection pipeline to remove correlated and irrelevant features.

hamming_distance

Calculate the Hamming distance between two individuals.

init_valid_individual

Initialize an individual with a fixed number of selected features.

is_diverse

Check if an individual is diverse enough from a population based on Hamming distance.

mixed_selection

Mixed selection strategy: combines elitism and random selection.

mutate_and_fix

Mutate an individual and ensure it has exactly num_selected_features selected.

population_entropy

Calculate the entropy of a population of binary individuals.

Classes

GAFeatureSelector

Genetic Algorithm Feature Selector using DEAP.